Preliminary Python 2/3 support

Open
#1 · Created  · Last updated

Description

The purpose of this PR is to start supporting Python 3 while retaining compatibility for Python 2 (though I may accidentally have reduced support for very old versions like 2.2).

It is by no means comprehensive - I've concentrated on code needed for my forked project and code I could test. In particular, the tests in tests/test_*.py still pass in Python 3.5 and Python 2.7.

Still, further changes will be needed for parts of the codebase I haven't visited. I would suggest not merging this PR, but using it to evaluate what needs to be done, or perhaps using it as a starting point.

The requirement for scriptine is something of an obstacle: it has an outstanding PR for Python 3 support but I'm not sure the package is still maintained. I've actually changed the requirement here to my own version.

I have separated the PR into multiple commits for ease of review: each commit should only involve one transformation. But if you do merge this PR, I'd suggest a squash-merge.

I've used a lot of advice from http://python-future.org/compatible_idioms.html and preferred forms which are efficient in both Python 2 and 3.

Please do not hesitate to ask for clarification or raise further issues.

0 attachments

0 comments

Loading commits...