Back in February, I decided to write my blogging software—KangaPy—in Twisted.
For those who have it come across it before, Twisted is a single threaded, “event-driven networking framework.” The price of using Twisted is that your code must never block on I/O. Instead, the code must return a “Deferred” object that contains a callback which is fired when the I/O operation completes.
In return for writing your code inside-out, Twisted gives you a framework that scales well, freedom from multi-threading concurrency issues and a very clear idea of how your application interacts with the outside world.
Aside from that, Twisted has three1 big pluses:
Unfortunately, a blog with a simple web interface on one end and an RDBMS on the other is not a good fit to Twisted. Since KangaPy is due a major refactoring, I had to decide whether to stay with Twisted (and start using Nevow) or move to a different framework.
I decided to port KangaPy to another framework. This will most likely be CherryPy with Cheetah templates, but time will tell.
I’m glad I decided to give Twisted a go, because the experience may well turn out to be useful in other contexts. I’ve already had one project for which Twisted would have been a great choice, except that my client needs it done in Java.
And finally, a big thanks to Matt Goodall and Donovan Preston for taking the time to point me to Nevow. I played with the tutorials, and it looks great. If you ever manage to make Nevow useful without Twisted, I’d be very interested.
1 This is just my opinion, formed in the light of limited experience.