[Python-Dev] Synchronous and Asynchronous servers in the standard library

Josiah Carlson jcarlson at uci.edu
Sun Nov 7 19:39:43 CET 2004

James Y Knight <foom at fuhm.net> wrote:
> On Nov 6, 2004, at 6:05 PM, Josiah Carlson wrote:
> > A recent patch to offer an SMTP server (SocketServer derivative) 
> > sparked
> > the below...
> >
> > Question:
> > Does we (and by 'we' I mean those in charge of developing Python) want
> > to offer both asynchronous (deriving from asyncore, asynchat, etc.) and
> > synchronous versions of server software in the standard library?
> I'd like to introduce you to Twisted (http://www.twistedmatrix.com).
> More cooperation and code-sharing between Twisted and Python core 
> developers would certainly be nice. But I don't think the right 
> direction to go for that is writing a bunch of half-assed async servers 
> in Python core. I guarantee you it isn't going to be trivial to do 
> nicely. There has been a small amount of discussion about contributing 
> parts of the Twisted core into Python, but so far no one has 
> volunteered to head that project. So, if you're interested, perhaps 
> you'd like to take it on. I suspect even that will be a lot of work -- 
> you'd have to get consensus on which parts, if any, would be included. 
> Figure out acceptable solutions to versioning skew between twisted 
> releases and python's included copy. Etc.

It seems as though there has already been discussion of getting portions
of Twisted into the Python standard library.  Being as I have not
developed with Twisted, nor am I really a part of the Twisted community,
I'm not sure that I am really the right person to try to figure out what
parts of Twisted should or should not be included with Python 2.5.

Regardless of the asyncore vs Twisted issue, a proper (meta) framework
should separate out the calls for "what happens to the internal state
when the server receives a reqest like 'foo'", and how the data actually
gets to those calls.  If done correctly, if/when portions of Twisted
make it into the standard library, it shouldn't be terribly difficult to
offer a mechanism to use Twisted as a base (for someone with Twisted and
stdlib Twisted experience), if such a thing is desired.

I suppose the question comes down to; should there be a meta framework
for developing servers in Python that specifies a separation between the
protocol logic and how data gets to that protocol logic?  The desire is
for a mechanism to allow people to create a single version of a server
in their favorite framework (SocketServer, asyncore, Twisted, or other),
and for others to be able to use them in their favorite framework with
little difficulty.

 - Josiah

More information about the Python-Dev mailing list