Got Python 3 support ?
by Tarek Ziadé
One thing that slows down the adoption of Python 3 is the low number of available third party projects. If your project depends on some other projects, you are pretty lucky if they are all available under Python 3.
I don’t think that the problem comes from the Python 3 syntax adoption, because Python provides a pretty powerful tool to convert your Python 2 code into Python 3 code, called 2to3. (notice that the backward process is also available since this summer : 3to2).
The biggest issue in my opinion is the lack of packaging support. Distutils itself works fine on Python 3, but I am talking about Setuptools, which is widely used in the community and doesn’t work under Python 3. So if your project, or one of its dependency uses Setuptools, you can’t switch to Python 3.
Well, I am glad to say that this is not true anymore, thanks to Martin von Löwis, Lennart Regebro and Alex Grönholm that have been working on Distribute’s Python 3 support lately.
The Distribute project is a fork of the Setuptools project and is now fully compatible with Python 3.
If you are using Setuptools, install Distribute 0.6.3, read its docs/python3.txt file and add Python 3 support to your project.
And if you need help in porting your distribution to Python 3, drop in Distutils-SIG, we will help you.
[Waves his arms around wildy in excitement.] Congratulations!
Totally agree: Lack of setuptools is holding back Python 3.0 adoption. Pretty much everything I do depends on Setuptools. Now that Distribute supports Python 3.x I have no more excuses not to port my stuff to the next python.
@Benjamin: Thanks !
@Salim: Yes, I hope this will create a momentum in the community for people to port stuff
As far as momentum goes, 3to2 might be more significant, but it doesn’t seem to be widely known about yet. The lack of setuptools was definitely a hang-up. However, until 3to2, the way to support Python 2 and Python 3 was to write Python 2 that was ready for 2to3, and let people try their luck if they need Python 3. Now, perhaps, people can shift their development focus to Python 3 and try to support Python 2 with 3to2.
Nice work!
You know what would help? A short blog post demonstrating how to take a setuptoolsified Python 2.x package and make it work with Distribute, on both 2.x and 3.x, and how to upload it to PyPI so that people with both 2.x and 3.x can easy_install it.
I’m still a bit fuzzy whether it’s possible to use a single source tree with both 2.x and 3.x. I think Distribute has this argument that runs 2to3 for you automatically during setup.py build?
@Daelin, @Marius: yes, the philosophy of Distribute is to provide a tool to automatically run 2to3, so you only have one code base.
See http://bitbucket.org/tarek/distribute/src/7a83538a8dc7/docs/python3.txt
(Marius, I’ll add a blog post on how to port, it’s a good idea)
@Rene: Thanks !
[…] Browsing: https://tarekziade.wordpress.com/2009/09/26/got-python-3-support/ distutils/setupttols for !python […]
[…] Browsing: https://tarekziade.wordpress.com/2009/09/26/got-python-3-support/ distribute (setuptools fork) for !python […]