[Python-Dev] 2.7 Release? 2.7 == last of the 2.x line?

"Martin v. Löwis" martin at v.loewis.de
Wed Nov 4 20:56:27 CET 2009


>> That's not my experience. I see a change in source (say, on Django)
>> available for 3.x within 5 seconds.
> 
> This is for which version of 2to3 ? I got similar experience (several
> minutes), but maybe I am using 2to3 the wrong way. On my machine, with
> 2to3 from 3.1.1, it takes ~ 1s to convert one single file of 200
> lines, and converting a tiny subset of numpy takes > one minute.

The version released with 3.1. The trick is not to recompile all 2to3
code every time you make a source change. Instead, cache the 2to3 output
in the build area, and have setup.py only invoke 2to3 for the files
that got modified.

So whenever I make a change, I do "python3 setup.py install". This
checks all timestamps, finds the modified files (which will only be
one), runs 2to3 on it, and then copies it into my 3.1 installation,
where I can test the change. Recompiling a single file typically takes a
few seconds, or less. It would be possible to also run out of the build
area; you still would need to run "setup.py build" after every change.

There is already support for this in both distutils (as released in
3.1), and distribute.

Regards,
Martin


More information about the Python-Dev mailing list