[Chicago] 2 talks

Kumar McMillan kumar.mcmillan at gmail.com
Thu Nov 11 21:27:37 CET 2010


On Thu, Nov 11, 2010 at 2:01 PM, Peter Fein <pfein at pobox.com> wrote:
> In theory, 2to3 and 3to2 are supposed to help with this... though there's
> still a motivation problem. I think a lot of packages will never get ported,
> and just fade away. Not necessarily a bad thing IMO.

Heh, yeah, Darwinism!

>
> How does the packaging around this stuff work? Do you create different names
> on PYPI for 2 vs. 3? Run 2to3 in your setup.py?

Some people publish separate package names but I think it's poor form.
 The way I did it for fudge was to publish one package and let the
conversion happen at install time via setup.py.  For example, if you
do:

$ pip install fudge

In 2.x then it does what you want.  If you do this in 3.x it also does
what you want:

$ easy_install-3.1 fudge

This would work with pip too but there isn't a version of pip for 3
yet (afaik).  Note that easy_install is part of Distribute and is not
the same as the old easy_install.

So...all the magic happens with a special setup argument of
use_2to3=True: https://bitbucket.org/kumar303/fudge/src/tip/setup.py

You could also simply publish a 3.x compatible egg without creating a
new package.  I.E. just:

$ python3.1 setup.py bdist_egg register upload -s

You'd also need Distribute to build an egg (I think).


-Kumar


More information about the Chicago mailing list