Whats the proper procedure to deal with 2to3 apps

I am writing an application that I intend to distribute as a python 2 and a python 3 app.  Im new to python so I not sure about the right way to do things.  

What I want is to have 2 source folders and 1 test folder.  I want to be able to write the app in python 2, then click a button that runs 2to3 and puts that output in the second source folder, then run the unit tests against the code in the python2 folder and then again on the code in the python3 folder.

it doesn't seem to be possible to tell pycharm's inspections to have the code in the py2src follow the syntax of python2 and the code in the py3src follow the python3.  Am I going to have to have two different projects?  

anyone have a blog or white paper on the best practices to pull this off?
3 comments
PyCharm doesn't have any special support for writing code in such a way. You can set up two projects and open them in the same window, and set up an external tool for running 2to3, however, this isn't really a recommended procedure.

Please consider writing your application to use same source for Python 2 and Python 3 instead: http://docs.python.org/3/howto/pyporting.html#use-same-source
0
If I do the same source thing, which interpreter do i use, 2 or 3?  The problem I was having was for example basestring.  I put together an if statement to deal with this and if I ran with the 3 interpreter, pycharm would complain that basestring doesn't exist in 3.
0
If you do the same source thing, it doesn't matter which interpreter you use, and it also means that you can't directly use things like basestring which don't exist in Python 3. Instead of this, you need to use something like the 'six' library: http://pythonhosted.org/six/
0

Please sign in to leave a comment.