Archives / Search ›

Migrating from Medusa/asyncore to Twisted

Bob Ippolito raises some architectural questions about PyDS, and suggests it move to Twisted to prevent reinventing the wheel and improve its architecture. He also suggests bsddb instead of Metakit, but I’m hardly unbiased on that one given the work I’ve done with Metakit and the BDB-using Subversion in the last year.

This discussion brings me back to a couple of projects I’ve been working on recently, one of which uses Medusa, and the other asyncore.

Sakana, Wiki-like server software originally written for Danger’s developer site, is built with Medusa. I set it up at ACM earlier this year, and have been really happy with how well it’s taken off. It’s generally well-written, but really needs revision control and a plugin architecture. MoinMoin is the definitive Python Wiki, with loads of features and extensibility, but I really don’t like the way it does many things, most obviously the use of WikiWords and complicated markup syntax.

cognetd is the back end for a multiprotocol chat-style client. Consider its relationship with the cognet client a bit like sirc’s relationship with ssfe. The cognet client presents a multiwindowed interface but knows nothing about IRC, Telnet, Finger or any of the other supported protocols. cognetd uses asyncore/asynchat for almost all networking, and doesn’t rely on any other code to implement the various protocols it handles.

Twisted is very large, consisting of a lot of smaller projects bound together by some common architecture. I’m likely to like some of them and not others. The most I’ve done with Twisted was a hundred-line Telnet to X-10 gateway, which worked beautifully, but I’m still hesitant before considering migrating thousands of lines of other people’s code. Unlike with PyDS, there are no significant performance or architectural problems with either Sakana or cognetd, which makes it a harder sell to move the code. Sakana could use a real templating mechanism, and adding protocols to cognetd means implementing them on top of asyncore.

I plan to use Twisted for a more sophisticated project, as the Web front end to a document management system I’m working on. After completing it, I’ll have a better grasp of Twisted fundamentals and will might see if I can migrate cognetd gradually. More on that later: I’ve got a midterm to study for.

(By the way: if anyone stumbles onto this weblog, I’m not sure if this arrangement will be permanent yet, but it will continue until I have time to set anything else up.)

No comments yet. Be the first.

Leave a reply