[Twisted-Python] CFReactor redux

Phil Christensen phil at bubblehouse.org
Mon Oct 22 23:42:42 EDT 2007

It's been awhile since this was brought up on the mailing list, but  
I'd like to see if anyone has any real interest in using Twisted with  
Cocoa on Mac OS X.

It was suggested to me that one thing that was needed was a reactor  
based on ThreadedSelectReactor that would integrate with the Cocoa  
runtime. I've posted my results here:


This class is extremely trivial, but it makes working with PyObjC/ 
Twisted apps a bit more straightforward.

However, there are significant issues with the entire TSR approach.  
The primary one is that it's impossible to do any Trial testing,  
because as far as I can tell, it is impossible to make the  
CFReactor's run() method return without terminating the entire process.

I have a couple questions for the group, namely:

1.) Does anyone with a better grasp of Cocoa/PyObjC development have  
any ideas on how a suitable reactor might be implemented?

2.) Is there any way to run the unit tests without restarting the  
reactor between each test? I'm sure this would cause many tests to  
fail, but at least we'd be able to see if there was any other major  
issues. I'm not suggesting any changes be made to trial. I'm just  
looking for any possible way to run the tests manually.

3.) Will anyone use this? I know the core devs are generally  
uninterested in supporting a Cocoa reactor, but I'm glad to maintain  
this if it would be used.


More information about the Twisted-Python mailing list