[Python-3000] Making 2to3 installable
Guido van Rossum
guido at python.org
Sun Mar 16 22:43:03 CET 2008
On Sun, Mar 16, 2008 at 4:22 PM, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> >> Wrt. invoking it from distutils: Why not?
> > Because it's far from perfect. I'd expect the success rate of running
> > 2to3 over a 2.x package to be close to zero. I think this is one case
> > where it's better to let the developer run 2to3 and tweak the app
> > until it actually works.
> Ah. I still dream of people being able to use a single source for both
> 2.x and 3.x. They would maintain their source as 2.x, and convert to
> 3.0 at deployment time.
> Of course, they have to change their source to make that actual work.
> Most distutils projects probably won't work when all you do is run
> 2to3. However, if a project has prepared its source in a proper way
> (for some definition of "proper"), it *should* be possible that all
> remaining changes are done by 2to3.
> People would try the process on their development machines, and change
> the code until it actually runs under both versions.
> I'll be using my sprinting time to find out whether that approach
> can actually work.
That would be good. I agree with the ideal process, but I doubt that
it will realistically work exactly like that, so I expect that calling
2to3 upon install is just going to cost a lot of CPU time and then
produce a non-working install.
> >> Wrt. this covering all uses: Surely the ones that people
> >> would use the library for, no?
> > I not understand. :-(
> When people requested that 2to3 is a library, I think they
> have exactly that use case in mind: programmatically convert
> a source code base at deployment/build time. In those cases,
> they can achieve the same thing with the command line tool.
I don't recall what the person who asked about this after my keynote
had in mind, but it sounds to me like converting code at install time
a minority use case -- especially while 2to3 is as slow as it is.
> Of course, on Windows, it is probably still better to use
> the library, since Python will find the library, but may
> not find the command line tool.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000