[Twisted-Python] Using six for Python3 porting
![](https://secure.gravatar.com/avatar/c194a4d2f2f8269aa052942e87985198.jpg?s=120&d=mm&r=g)
Hi, I feel that twisted.python.compat is slowly duplicating / reinventing an important part of the six code. Code which does not import from twisted.python.compat will have all kind of ad-hoc / in module code to handle differences between py2 and py3 and many if _PY3 conditional blocks. What do you say if we add six as dependency for twisted ? In case you don't want six as a dependency, it can be copied in twisted code base and make it available from twisted.python.six or a similar package. -- Adi Roiban
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
On Apr 24, 2015, at 02:41, Adi Roiban <adi@roiban.ro> wrote:
Hi,
I feel that twisted.python.compat is slowly duplicating / reinventing an important part of the six code.
Code which does not import from twisted.python.compat will have all kind of ad-hoc / in module code to handle differences between py2 and py3 and many if _PY3 conditional blocks.
What do you say if we add six as dependency for twisted ?
In case you don't want six as a dependency, it can be copied in twisted code base and make it available from twisted.python.six or a similar package.
I think that this is basically the right thing to do, since almost all of our optional dependencies depend on it. I'm somewhat surprised that zope.interface hasn't forced this on us already, honestly; what are they doing for a compatibility layer? I don't want to ssh in to 25 builders and manually install six on each one though. We should figure out a better dependency management solution for the build fleet so this doesn't have to be a hassle. (And also to make coverage of certain things easier; for example, the tests fail currently if you install sphinx.) The first step in this is probably removing me as a bottleneck for administrative tasks, which we are already working on (thank you adi and hawkowl). -g
![](https://secure.gravatar.com/avatar/c194a4d2f2f8269aa052942e87985198.jpg?s=120&d=mm&r=g)
On 24 April 2015 at 08:00, Glyph <glyph@twistedmatrix.com> wrote:
On Apr 24, 2015, at 02:41, Adi Roiban <adi@roiban.ro> wrote:
Hi,
I feel that twisted.python.compat is slowly duplicating / reinventing an important part of the six code.
Code which does not import from twisted.python.compat will have all kind of ad-hoc / in module code to handle differences between py2 and py3 and many if _PY3 conditional blocks.
What do you say if we add six as dependency for twisted ?
In case you don't want six as a dependency, it can be copied in twisted code base and make it available from twisted.python.six or a similar package.
I think that this is basically the right thing to do, since almost all of our optional dependencies depend on it. I'm somewhat surprised that zope.interface hasn't forced this on us already, honestly; what are they doing for a compatibility layer?
They have this: https://github.com/zopefoundation/zope.interface/blob/master/src/zope/interf...
I don't want to ssh in to 25 builders and manually install six on each one though. We should figure out a better dependency management solution for the build fleet so this doesn't have to be a hassle. (And also to make coverage of certain things easier; for example, the tests fail currently if you install sphinx.) The first step in this is probably removing me as a bottleneck for administrative tasks, which we are already working on (thank you adi and hawkowl).
I am happy to help with updating the builders as long as there is someone willing to review the changes. At this stage I just want to know if we want six in Twisted. We can also start with distributing six together with Twisted code and move it outside twisted once builders are fixed. -- Adi Roiban
![](https://secure.gravatar.com/avatar/174e7b0ff60963f821d0b9a4f1a3ef52.jpg?s=120&d=mm&r=g)
On 24 Apr 2015, at 8:41, Adi Roiban wrote:
I feel that twisted.python.compat is slowly duplicating / reinventing an important part of the six code.
I’m +1 on this too. I was a bit hesitant in the past but duplicating compatibility code everywhere is becoming ridiculous and a hassle.
![](https://secure.gravatar.com/avatar/b973c2a161019ba60c4f30ad598ced4d.jpg?s=120&d=mm&r=g)
On 2015-04-24 08:41, Adi Roiban wrote:
Hi,
I feel that twisted.python.compat is slowly duplicating / reinventing an important part of the six code.
Code which does not import from twisted.python.compat will have all kind of ad-hoc / in module code to handle differences between py2 and py3 and many if _PY3 conditional blocks.
What do you say if we add six as dependency for twisted ?
In case you don't want six as a dependency, it can be copied in twisted code base and make it available from twisted.python.six or a similar package.
I vaguely remembered working on this at PyCon in 2014: https://twistedmatrix.com/trac/ticket/7177 -- ralphm
participants (4)
-
Adi Roiban
-
Glyph
-
Hynek Schlawack
-
Ralph Meijer