[Twisted-Python] Helping the Python 3 port

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Wed May 8 15:02:47 EDT 2013


On 02:30 pm, jon at multani.info wrote:
>Hi,
>
>I'm interested to give a help to port Twisted to Python 3.
>I gave a look at the tickets on Trac tagged with py3k and those in the
>Python-3.x milestone. I gave a try at
>http://twistedmatrix.com/trac/ticket/5802 to see what still needed to 
>be
>done, and after rebasing the patch on trunk and starting to hack a few
>modules, I noticed that I have to do those 3 things in a bunch of
>places:
>
>* use the newer "except Exception as e" instead of "except Exception, 
>e"
>* use the print function instead of the print statement
>* replace "implements(IFoo)" by the class decorator 
>"@implementer(IFoo)"
>
>I can probably post a new patch which fixes all those things in order
>for Trial (as per #5802) to just start, but I wonder if this is the
>right approach and if it wouldn't be better to fix those first (since
>they are, AFAIK, compatible with Python 2.6 anyway).
>
>Any idea?

To expand on what others have said in this thread, here's another 
approach you might consider:

  1) Open up twisted/scripts/trial.py and look at what Twisted modules it 
imports.

  2) If you do this, you'll see it uses (among other things) 
twisted.python.usage.

  3) Look at admin/_twistedpython3.py, you'll see that 
twisted.python.usage hasn't been ported yet.

  4) Look at twisted/python/usage.py and you'll see it doesn't have very 
many Twisted dependencies (making it a better candidate for porting work 
than twisted/scripts/trial.py).  Look through the tracker to see if 
there's a ticket for porting any of these.  As it turns out, 
twisted.python.util has already been ported and there are tickets for 
twisted.python.reflect (#6239 - sort of) and twisted.python.text (#1601 
and #6341 - sort of).

  5) Pick up one of those dependency tickets to start with - #1601 and 
#6341 seem to be in progress, but I don't see anyone actively working on 
#6239.

  6) Port that module by making its test suite pass and generally 
following the steps given the Python 3 porting page on the wiki.

Jean-Paul



More information about the Twisted-Python mailing list