[Python-porting] [Announce] python-future package

Ed Schofield ed at pythoncharmers.com
Thu Sep 26 06:07:40 CEST 2013


Hi everyone,

I have been working on single-source compatibility layer for Python 3/2 called "future". It has a similar goal to Benjamin Peterson's "six" package but takes a different approach: allowing clean Python 3 code to run almost unchanged on Python 2. It contains Python 2 backports of various pieces of Python 3 functionality like the bytes object.

It's on PyPI here:

    https://pypi.python.org/pypi/future

and the code repository is here:

    http://github.com/edschofield/python-future

My hope is that it will speed up the adoption of Python 3 by reducing the complexity of supporting both Py3 and Py2. Ideally it would help many people to start writing clean forward-compatible Py3 code today even if their dependencies aren't all ported yet.

The source tree comes with a lib2to3-based conversion script called "futurize", which has similar aims to Armin Ronacher's "python-modernize", but aims to produce standard Python 3 code that runs on both Py3 and Py2 using "future". The script translates both ways: from either Python 2-only or Python 3-only code, using a selection of fixers from 2to3, 3to2, python-modernize, and some custom ones.

I ran the initial design ideas past Nick Coghlan and Richard Jones privately after PyCon AU and then presented it informally to the Melbourne Python user group. I expect the implementation should be quite robust; most of the magic got thrown away after the v0.0.x prototypes. I haven't announced the project widely until now, but I've now got a high enough level of test coverage and documentation that I'm happy doing that.

I'd be very interested in your feedback -- on the design or implementation, or feature requests, bug reports, or anything else! :-)

Best wishes,
    Ed


--
Dr. Edward Schofield
(M) +61 (0)405 676 229
Python Charmers
http://pythoncharmers.com 




More information about the Python-porting mailing list