[Tutor] Python3 : Yes --- Python2 : No ?

Oscar Benjamin oscar.j.benjamin at gmail.com
Sun Sep 22 19:49:49 EDT 2019


On Sun, 22 Sep 2019 at 18:22, Albert-Jan Roskam <sjeik_appie at hotmail.com> wrote:
> What would the best approach to convert that much code? I mean, with sooooo many dependencies! Each individual project would start with git checkout -b py3. Then run 2to3. Then see what that 2to3 script did to the unittests. Then fix the tests. Then fix the code so the tests pass. Meanwhile py2 bugs may also need to be fixed and git-cherrypicked onto the brittle py3 code. Brrr. But one should have a way to prioritize what needs to be converted, i.e. determine what modules are the most common dependencies. Is there a generic approach for this? Jenkins CI woukd be very useful, I think. It seems daunting!

The obvious approach is to work through it one step at a time from the
bottom of your dependency stack. For each dependency consider whether
it supports Python 3 or whether it can easily be made to support
Python 3 or whether it can be replaced with something newer.

Although it is daunting there are also opportunities in all this to
clean things out, make changes that needed to be made etc. Often the
hardest part of an overhaul is that as you dig into everything you
discover lots of bugs. The parts that fail (and aren't trivially
fixable) under a transition are often those that were not well
designed or implemented in the first place.

The question is: will you fix those bugs or will you make them one
level worse by papering over during the transition?

Oscar


More information about the Tutor mailing list