Today I had the pleasure to talk at the Amsterdam Python Meetup Group about Tulip, PEP-3156 and async i/o in Python. Here are the slides:
Big thank you to the guys at Byte for hosting tonight’s meetup and providing us with nice drinks and pizza 🙂
Already looking forward to the next one!
For those who don’t know, PEP 3156 is a proposal for asynchronous I/O in Python, starting with Python 3.3. Until now each framework (Twisted, Tornado, …) has defined it’s own interface for defining protocols and transports. This makes very difficult if not impossible to reuse a protocol implementation across frameworks. PEP 3156 tries to fix that, among other things.
The reference implementation is called Tulip and can be found here. It’s a fast moving target, but it already contains working event loops for Windows and Unix systems. It uses pollers available in the select module for the Unix side, and a C module wrapping Windows IOCP functionality for Windows.
I was really excited to see this come through, so I started playing with it by implementing a pyuv based event loop. I called that it rose. It was a lot easier to implement than expected and it currently passes the entire test suite 🙂
Code can be found on GitHub.
Here is a quick example, the usual echo server, using rose and tulip:
Come and join the discussion in the python-ideas mailing list!