PyCon 2016 in Portland, Or
hills next to breadcrumb illustration

Tuesday 3:15 p.m.–4 p.m.

The Report Of Twisted’s Death or: Why Twisted and Tornado Are Relevant In The Asyncio Age

Amber Brown

Audience level:
Python Libraries


With asyncio on the scene, the question has been asked: is there any point in having Twisted or Tornado around?


Historically, there has been no “standard way” of doing asynchronous I/O in Python. A variety of solutions, from using threads (WSGI), processes (multiprocessing), green threads (gevent), or selector loops (Tornado, Twisted) have all been used to similar degrees, but apart from the (now deprecated) standard library asyncore/asynchat, Python itself did not have a blessed option. PEP 3156, or “the asyncio PEP”, introduced in Python 3.4, provides this blessed option, choosing a standard selector loop approach (or “reactor”, in Twisted parlance). Backports exist for Python 3.3 (tulip) and 2.7 (trollius), and asyncio is fully featured enough to implement most of the things you would want for an asynchronous framework. asyncio, as outlined in the PEP, was designed to be an interoperable common ground for which other frameworks such as Twisted or Tornado could use or implement. The role of asyncio may seem muddled in the eyes of developers new to asynchronous programming, or those that may not understand the technical details of asyncio nor the political environment in which it was created. This talk will teach you how Twisted or Tornado supplement asyncio, how asyncio can/is integrated with these frameworks, and makes a case for the continued development of new and existing selector-loop based frameworks. It will also paint a picture of the future direction of Twisted, why the original plan of asyncio as a standard API has not come to complete fruition, and what can be done about it.