diesel is a framework for writing network applications using asynchronous I/O in Python.
It uses Python's generators to provide a friendly syntax for coroutines and continuations. It performs well and handles high concurrency with ease.
An HTTP/1.1 implementation is included as an example, which can be used for building web applications.
Here's how easy it is to write a simple echo server:
#!/usr/bin/env python2.6
from diesel import Application, Service, until_eol
def echo(remote_addr):
their_message = yield until_eol()
yield "you said: %s\r\n" % their_message.strip()
app = Application()
app.add_service(Service(echo, 7050))
app.run()
You can find a nice overview of the nitty-gritty details in the documentation.
Currently, we are developing diesel primarily to meet the requirements of ShopTalk, a web-based group chat application for companies. However, we have been using the library for several years now on other projects. It has been tested with many applications, both HTTP and otherwise. We've found that it makes writing asynchronous applications a breeze.
We are releasing diesel as open source now, because we sense that the community is becoming more interested in asynchronous applications due to the rise in popularity of Comet. The open source community can benefit from diesel's accessible API, and diesel can benefit from the testing and contributions of the community.
We will be actively answering questions on the mailing list. Feel free to join in the discussion and send us your questions and comments.
The diesel source is hosted on bitbucket. Head over there to grab the source and fork the repository. The source repository also contains a copy of the documentation.
The underlying asynchronous library is only one piece of the puzzle. Once this foundation is in place, it becomes much easier to build more useful asynchronous software. In fact, we already have.
We will be releasing the other components of our stack as they become more mature. You can follow us on Twitter if you'd like to be kept apprised of future diesel releases.