-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert to python 3 #41
base: master
Are you sure you want to change the base?
Conversation
I though the develop branch was already on python 3. The changes were just never merged to the main branch. |
@zetadin Hmm, you’re right! I didn’t know that. The 2 to 3 conversion is done in a very similar way there - I compared the C code and it’s almost exactly the same. It also looks like the develop branch has a bunch of other feature changes as well as the 2 to 3 conversion. It might be nice to just do this (and thoroughly regression test) then apply the other changes on top. That sounds like probably two major version numbers, pmx 3.0 for python 3 (kinda rhymes) and 4.0 for the new features. I’ll wait for @vgapsys to have a look. In any case happy to help port/package/test/etc |
Hey @aizvorski, thanks for the interest in pmx. As @zetadin wrote, the 'develop' branch is already in python 3. It also has many new functions and reworked mutation libraries. Unit testing is in part supported, but regression tests are not there. If you are interested in development, testing etc, it would be best to start with the 'develop' branch |
This pull request converts pmx from python 2 to 3
Most of the conversion was automatic, the steps were as follows:
reindent --recurse .
to fix the mixed tabs/spaces indentation2to3 --write .
to make all the changes that 2to3 knows about: make print statements into functions, etcimport _pmx
becomesfrom . import _pmx
string.join()
andsplit()
with python3 equivalents, remove__cmp__()
, etcThis should work with essentially any version of python 3; tested on 3.10. There hasn't been much effort to keep backwards compatibility: python 3 has been around since 2008, and python 2.x was officially EOL in 2020. In some cases backwards compatibility would be relatively easy (the C API changes are probably already compatible), but it would be a substantial amount of work to really pull it off.
Testing:
I'd really like to set up a regression test comparing old vs new outputs, and ideally on a larger/more complex example like building the edge files in protLig_benchmark. Please let me know if you have something like that that runs in the old version and I can set up the comparison.
Also please let me know if there is anything else you'd like to see before you consider merging this.