[Python-3000] Making 2to3 installable

"Martin v. Löwis" martin at v.loewis.de
Sun Mar 16 22:22:37 CET 2008


>>  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.

>>  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.

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.

Regards,
Martin



More information about the Python-3000 mailing list