The new Python asyncio module aka “tulip”

Asynchronous becomes very popular nowadays. The Javascript language has node.js, Erlang language has XXX, the Go language has Goroutines and Channels. What about Python?

asyncio projects

Trollius flower, logo of the Trollius project

asyncio event loops

Talks about asyncio

Tulip projects

  • aiohttp: HTTP client/server for asyncio (PEP-3156)
  • irc3 plugable irc client based on python’s asyncio
  • rainfall: Here’s one more framework =) It allows using @asyncio.coroutine for handlers and supports jinja2 templates
  • Vase

Low-level libraries

What?

  • sockets (network), stream (TCP) and datagram (UDP)
  • pipes (subprocesses)
  • files
  • signals

Operating system synchronous I/O multiplexing, I/O event notification facility:

  • select
  • poll
  • epoll: Linux
  • kqueue: FreeBSD, Mac OS X, NetBSD, OpenBSD, DragonflyBSD
  • devpoll: Solaris
  • Windows proactor (IOCP)

C libraries:

  • libuv
  • libev
  • libevent, libevent2

Python libraries:

  • pyuv (libuv)
  • pyev (libev)
  • pyevent (libevent)

Common features:

  • asynchronous DNS resolution
  • multiplexing

Coroutines

Conference:

Projects:

High-level libraries

Python builtin modules

  • multiprocessing: Python 2.6
  • concurrent.futures: Python 3.2 (Pool of threads/processes)

Issues with eventlet