[TransWarp] PEAK + Twisted?

Joel Boehland joel at memes.com
Wed Jul 9 14:20:22 EDT 2003

This was resent using a different 
"From:" address because my previous one 
email was sent from an address not on 
the list. I apologize for any duplicates.

This is an extension to a discussion 
that was taking place on the #peak irc 
channel. Some of us were thinking it 
would be a good practical excercise to 
"PEAK-ify" a simple twisted app to 
showcase the two coolest python 
frameworks working together It would 
also provide a quickpath for potential 
developers on the best way to integrate 
the two frameworks.

Going from there, we thought the best 
twisted app to PEAK-ify would be the 
simple echoserver located in twisted's 
doc/examples directory.

Here it is in all its glory:
from twisted.internet.protocol import 
Protocol, Factory
from twisted.internet import reactor

### Protocol Implementation

# This is just about the simplest 
possible protocol
class Echo(Protocol):
     def dataReceived(self, data):
         """As soon as any data is 
received, write it back."""

def main():
     f = Factory()
     f.protocol = Echo
     reactor.listenTCP(8000, f)

if __name__ == '__main__':

Sooo-- the question to the PEAK 
community is what is the best way to 
make this twisted protocol part of a 
component in a PEAK application? I can 
see that there is some twisted support 
in the peak.running.interfaces, and 
peak.running.scheduler modules, but I'm 
having a hard time wrapping my head 
around the intended way they should be used.

The rough path that I can see, using the 
bulletins example app as a reference is 
to have a echoapp.ini with stuff like this:

reactor = getTwistedReactorSomehow()....
factory = 
app = peak.running.scheduler.MainLoop 

Anyone have any comments on this 
approach? Even better-- has someone 
already made a simple PEAK+twisted app 
they'd like to show off to other PEAK 

Thanks for any info,
Joel Boehland

More information about the PEAK mailing list