[Twisted-Python] qt4 reactor status

Hello- I'm wondering if anyone can fill me in on the current status and plans for Qt support under Twisted? I've been working with PyGTK for most of my cross-platform applications over the past decade or so, but mainly for license reasons and to be honest GTK+ still looks pretty much the same visually as it did back in the early 2000's (especially on Windows). It feels time to move on to something a little less tired and a little better suited to mobile deployment (starting with the N900 at least). With Qt4 being LGPL'd and PySide offering the same as an alternative to PyQT's GPL-or-commercial-only choices, it seems like there shouldn't be any barriers to supporting it, save interest and time from developers of course. The last piece of information I could dig up was this trac ticket: http://twistedmatrix.com/trac/ticket/3977 It sounds like Dr. Glenn Tarbox is happy with a potential license change on the original qt4reactor code, but that still needs confirmation from Itamar Shtull-Trauring and Gabe Rudy (with no further comment in the last nine months). Whether the code itself is compatible with the current releases of Qt, PyQt, or PySide isn't clear (there is certainly no "stable" release suitable for serious re-deployment that I can find). The source itself is located here: https://launchpad.net/qt4reactor ...but that code is now two years old, with the only update from Alan Franzoni a little over a year ago doing some initial cleanup work "in order to support better testing." I've really only begun getting familiar with Qt development, but as of this moment it seems like I should focus on learning the QtNetwork component and start porting over my Twisted libraries to that, as at least support is present and maintained - plus the licensing is clear. In the meantime, can anyone please update me if there has been any further work or consideration towards official Qt support for Twisted? Cheers Steve Castellotti

On 26 Jun, 06:03 pm, sc@puzzlebox.info wrote:
I think you nailed the status - it's an externally maintained reactor which probably works for some people. As far as plans for support go, there aren't really any. Most Twisted development happens without many specific plans though, so you shouldn't let that discourage you.
In the meantime, can anyone please update me if there has been any further work or consideration towards official Qt support for Twisted?
This isn't really specific to Qt - actually it's about Gtk - but it might be useful anyway. A number of issues with Gtk's network support have recently led me to believe that a better way to integrate with it would be to only put a single file descriptor into its event loop and trigger all other event notification based on that single descriptor. This can be done with epoll, where Gtk would watch the epoll descriptor, but then Twisted's epoll reactor would deal with actual socket events. It might be doable with IOCP reactor too, where a Windows Event is put into Gtk and then all of the IOCP operations trigger that one Event. It's doable with kqueue in a manner similar to that which applies to epoll. And if all else fails, there's the ThreadedSelectReactor approach. Perhaps Qt's networking support is on par with Twisted's, though, and such wouldn't be necessary. I don't know, as I have very little experience with Qt. I just wanted to mention the idea. Jean-Paul

On Sun, Jun 27, 2010 at 3:37 PM, <exarkun@twistedmatrix.com> wrote:
One issue with "official" support is PyQt licensing. If PySide is (or becomes) an alternative, the licensing issue would disappear and Twisted "could" include it in the distribution. AFAIK, there hasn't been any substantial work on the qt4reactor beyond what exists on launchpad and github. I have a few patches aging in my inbox which fix some Mac platform problems etc. <snip>
The design of the qt4reactor was driven by the need to integrate two event loops. Qt has its own asynchronous event handling core which is exposed through PyQt. Fortunately, its fairly straightforward to register a callback for twisted "stuff" (time and file descriptors) and it all works pretty well... (meaning it passed Twisted's torture tests at the time it was checked into launchpad). There is a non-traditional initialization using a non-blocking call to reactor.runReturn() which nails Twisted to PyQt. From that point on, Twisted behaves normally as does Qt / PyQt... The way god intended. The more fundamental question, IMHO, is the status and critical mass of PySide. Nokia was unable to reach agreement with Riverbank which caused uncertainty after Qt's move to open source. I don't know where this stands. If PySide is solid, and the API is similar to PyQt (which is the intent), porting qt4reactor to PySide is "probably" straightforward. I'm guessing that the qt4reactor remains functional as I've gotten email patches in the past few months. I would offer to check this out but I can't promise any timeline. I'm willing to field questions on any coding bizarreness to the degree my brain hardening doesn't interfere. -glenn
-- Glenn H. Tarbox, PhD || 206-274-6919 || glenn@tarbox.org - xmpp || ghtdak - aim,jabber,IRC,yahoo

On 2010-06-27 18:51 , Glenn Tarbox, PhD wrote:
Phil Thompson provides an exception to the GPL license that explicitly states that you can write modules using PyQt4 and release them under the MIT license (or some other license from an enumerated set of OSI-approved licenses).
PySide appears to be making steady, healthy progress. If one is on Linux, it would probably be worth an interested person's time installing it and changing your imports from "PyQt4" to "PySide" and see if it works. OS X and Windows builds are still some time away, but apparently the technical blockers have been fixed. It's just a matter of applied effort, probably. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco

First off, many thanks for the responses everyone, they are certainly appreciated! Comments below. On 06/27/2010 08:37 PM, Robert Kern wrote:
That's interesting (and good) to know. However I think ultimately whether PyQt4 or PySide was used as a base library for the qt4reactor, the next step would still have to be chasing down the remaining contributors to the reactor code and confirming they are willing to re-license their work. I might attach a request to the last ticket in the tracker as a start, and see if that gets any response. I'm only a user of Twisted and don't feel comfortable directly hassling folks who were kind enough to donate their time to its development.
Not to drift too far off topic, but from some initial exploratory development I can confirm PySide does seem a pretty complete and reliable alternative to PyQt4 (at least under Linux). I've manage to produce a basic interface using Qt4Designer and integrate a simple JSON client which runs equally well under both library wrapper modules. In the short term QtNetwork will probably be sufficient for my needs, but I would still advocate and support where/as possible a stable qt4reactor running under Twisted. Cheers Steve Castellotti

On Tue, 2010-06-29 at 12:43 +0000, exarkun@twistedmatrix.com wrote:
According the the Launchpad page, the qt4reactor code is GPLv2, not MIT: https://launchpad.net/qt4reactor I figured since there were issues which prevented PyQt (which is available under GPLv2) from being used, but which were address by PySide being LGPL, then the same issues would exist for the qt4reactor code as well? Cheers Steve

On Tue, Jun 29, 2010 at 5:43 AM, <exarkun@twistedmatrix.com> wrote:
I believe thats just me. There were a couple of bugs / upgrades / suggestions which I incorporated... and are annotated in the git repo on github with names and email (IIRC). So, maybe I just need to change the headers to make it MIT instead of GPL v2 and its all cool. -glenn
-- Glenn H. Tarbox, PhD || 206-274-6919 || glenn@tarbox.org - xmpp || ghtdak - aim,jabber,IRC,yahoo

On Tue, 2010-06-29 at 23:04 -0700, Glenn Tarbox, PhD wrote:
Actually, I think you're right. From the header of the main file in the launchpad trunk: http://bazaar.launchpad.net/~ghtdak/qt4reactor/trunk/annotate/head:/qt4react... # Copyright (c) 2001-2008 Twisted Matrix Lboratories. # See LICENSE for details. If Twisted Matrix has the Copyright, the license doesn't matter, they can dual-license under any second license they want. Any changes, unless individual Copyright was claimed by the contributor, would fall under the original Copyright. And considering you're the official maintainer, you should have the ability to do that, even if it hadn't been your code in the first place (c: At least I'm pretty sure that how it all works, I am not a lawyer and so forth. That should safely handle the licensing around the qt4reactor code, now I suppose its back to the small matter of making sure it works with the latest Qt4 and PySide codebase (c: Steve Castellotti Puzzlebox Limited

On Tue, Jun 29, 2010 at 11:31 PM, Steve Castellotti <sc@puzzlebox.info>wrote:
There was only one place where GPL was referenced... not sure why I put it there but it was clearly a bug... which I patched. I also copied Twisted's LICENSE file into the tree. If Twisted indeed holds copyright... then it was probably already their right to do whatever... This makes it more explicit perhaps. Since I'm not a bzr person, I fixed the code at github http://github.com/ghtdak/qtreactor I'd update launchpad but that might take a bit and somebody is gonna want to take over maintenance anyways. -glenn
-- Glenn H. Tarbox, PhD || 206-274-6919 || glenn@tarbox.org - xmpp || ghtdak - aim,jabber,IRC,yahoo

On 26 Jun, 06:03 pm, sc@puzzlebox.info wrote:
I think you nailed the status - it's an externally maintained reactor which probably works for some people. As far as plans for support go, there aren't really any. Most Twisted development happens without many specific plans though, so you shouldn't let that discourage you.
In the meantime, can anyone please update me if there has been any further work or consideration towards official Qt support for Twisted?
This isn't really specific to Qt - actually it's about Gtk - but it might be useful anyway. A number of issues with Gtk's network support have recently led me to believe that a better way to integrate with it would be to only put a single file descriptor into its event loop and trigger all other event notification based on that single descriptor. This can be done with epoll, where Gtk would watch the epoll descriptor, but then Twisted's epoll reactor would deal with actual socket events. It might be doable with IOCP reactor too, where a Windows Event is put into Gtk and then all of the IOCP operations trigger that one Event. It's doable with kqueue in a manner similar to that which applies to epoll. And if all else fails, there's the ThreadedSelectReactor approach. Perhaps Qt's networking support is on par with Twisted's, though, and such wouldn't be necessary. I don't know, as I have very little experience with Qt. I just wanted to mention the idea. Jean-Paul

On Sun, Jun 27, 2010 at 3:37 PM, <exarkun@twistedmatrix.com> wrote:
One issue with "official" support is PyQt licensing. If PySide is (or becomes) an alternative, the licensing issue would disappear and Twisted "could" include it in the distribution. AFAIK, there hasn't been any substantial work on the qt4reactor beyond what exists on launchpad and github. I have a few patches aging in my inbox which fix some Mac platform problems etc. <snip>
The design of the qt4reactor was driven by the need to integrate two event loops. Qt has its own asynchronous event handling core which is exposed through PyQt. Fortunately, its fairly straightforward to register a callback for twisted "stuff" (time and file descriptors) and it all works pretty well... (meaning it passed Twisted's torture tests at the time it was checked into launchpad). There is a non-traditional initialization using a non-blocking call to reactor.runReturn() which nails Twisted to PyQt. From that point on, Twisted behaves normally as does Qt / PyQt... The way god intended. The more fundamental question, IMHO, is the status and critical mass of PySide. Nokia was unable to reach agreement with Riverbank which caused uncertainty after Qt's move to open source. I don't know where this stands. If PySide is solid, and the API is similar to PyQt (which is the intent), porting qt4reactor to PySide is "probably" straightforward. I'm guessing that the qt4reactor remains functional as I've gotten email patches in the past few months. I would offer to check this out but I can't promise any timeline. I'm willing to field questions on any coding bizarreness to the degree my brain hardening doesn't interfere. -glenn
-- Glenn H. Tarbox, PhD || 206-274-6919 || glenn@tarbox.org - xmpp || ghtdak - aim,jabber,IRC,yahoo

On 2010-06-27 18:51 , Glenn Tarbox, PhD wrote:
Phil Thompson provides an exception to the GPL license that explicitly states that you can write modules using PyQt4 and release them under the MIT license (or some other license from an enumerated set of OSI-approved licenses).
PySide appears to be making steady, healthy progress. If one is on Linux, it would probably be worth an interested person's time installing it and changing your imports from "PyQt4" to "PySide" and see if it works. OS X and Windows builds are still some time away, but apparently the technical blockers have been fixed. It's just a matter of applied effort, probably. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco

First off, many thanks for the responses everyone, they are certainly appreciated! Comments below. On 06/27/2010 08:37 PM, Robert Kern wrote:
That's interesting (and good) to know. However I think ultimately whether PyQt4 or PySide was used as a base library for the qt4reactor, the next step would still have to be chasing down the remaining contributors to the reactor code and confirming they are willing to re-license their work. I might attach a request to the last ticket in the tracker as a start, and see if that gets any response. I'm only a user of Twisted and don't feel comfortable directly hassling folks who were kind enough to donate their time to its development.
Not to drift too far off topic, but from some initial exploratory development I can confirm PySide does seem a pretty complete and reliable alternative to PyQt4 (at least under Linux). I've manage to produce a basic interface using Qt4Designer and integrate a simple JSON client which runs equally well under both library wrapper modules. In the short term QtNetwork will probably be sufficient for my needs, but I would still advocate and support where/as possible a stable qt4reactor running under Twisted. Cheers Steve Castellotti

On Tue, 2010-06-29 at 12:43 +0000, exarkun@twistedmatrix.com wrote:
According the the Launchpad page, the qt4reactor code is GPLv2, not MIT: https://launchpad.net/qt4reactor I figured since there were issues which prevented PyQt (which is available under GPLv2) from being used, but which were address by PySide being LGPL, then the same issues would exist for the qt4reactor code as well? Cheers Steve

On Tue, Jun 29, 2010 at 5:43 AM, <exarkun@twistedmatrix.com> wrote:
I believe thats just me. There were a couple of bugs / upgrades / suggestions which I incorporated... and are annotated in the git repo on github with names and email (IIRC). So, maybe I just need to change the headers to make it MIT instead of GPL v2 and its all cool. -glenn
-- Glenn H. Tarbox, PhD || 206-274-6919 || glenn@tarbox.org - xmpp || ghtdak - aim,jabber,IRC,yahoo

On Tue, 2010-06-29 at 23:04 -0700, Glenn Tarbox, PhD wrote:
Actually, I think you're right. From the header of the main file in the launchpad trunk: http://bazaar.launchpad.net/~ghtdak/qt4reactor/trunk/annotate/head:/qt4react... # Copyright (c) 2001-2008 Twisted Matrix Lboratories. # See LICENSE for details. If Twisted Matrix has the Copyright, the license doesn't matter, they can dual-license under any second license they want. Any changes, unless individual Copyright was claimed by the contributor, would fall under the original Copyright. And considering you're the official maintainer, you should have the ability to do that, even if it hadn't been your code in the first place (c: At least I'm pretty sure that how it all works, I am not a lawyer and so forth. That should safely handle the licensing around the qt4reactor code, now I suppose its back to the small matter of making sure it works with the latest Qt4 and PySide codebase (c: Steve Castellotti Puzzlebox Limited

On Tue, Jun 29, 2010 at 11:31 PM, Steve Castellotti <sc@puzzlebox.info>wrote:
There was only one place where GPL was referenced... not sure why I put it there but it was clearly a bug... which I patched. I also copied Twisted's LICENSE file into the tree. If Twisted indeed holds copyright... then it was probably already their right to do whatever... This makes it more explicit perhaps. Since I'm not a bzr person, I fixed the code at github http://github.com/ghtdak/qtreactor I'd update launchpad but that might take a bit and somebody is gonna want to take over maintenance anyways. -glenn
-- Glenn H. Tarbox, PhD || 206-274-6919 || glenn@tarbox.org - xmpp || ghtdak - aim,jabber,IRC,yahoo
participants (4)
-
exarkun@twistedmatrix.com
-
Glenn Tarbox, PhD
-
Robert Kern
-
Steve Castellotti