Skip to main content

Experimental port of the Tulip project (asyncio module, PEP 3156) on Python 2.7

Project description

Trollius is an experimental port of the Tulip project (asyncio module, PEP 3156) on Python 2.7.

WARNING: Trollius code is in the “trollius” branch of the Mercurial repository, not in the default branch (which is the Tulip project). Command to download the development version of the source code (trollius branch):

hg clone ‘

Runtime Dependencies

The futures project is needed on Python 2 to get a backport of concurrent.futures.

Python 2.6 requires also ordereddict:

Test Dependencies

Unit tests require the mock module:

Python 2.6 requires also unittest2:

Differences between Trollius and Tulip

  • Trollius coroutines use “yield” and “raise Return(value)”, whereas Tulip coroutines use “yield from” and “return”.
  • On Python 2.7, asyncio.SSLContext has less features than the ssl.SSLContext of Python 3.3: no options, verify_mode cannot be modified (fixed to CERT_NONE), no set_default_verify_paths() method, etc.
  • Lock syntax of Tulip “yield from lock” is not supported in Trollius. “yield lock.acquire() try: … finally: lock.release()” should be used instead
  • Python 2 does not support keyword-only parameters.
  • If the concurrent.futures module is missing, BaseEventLoop.run_in_executor() uses a synchronous executor instead of a pool of threads. It blocks until the function returns, and so DNS resolutions are blocking.


The actual code lives in the ‘asyncio’ subdirectory. Tests are in the ‘tests’ subdirectory.

To run tests:
  • make test
To run coverage (coverage package is required):
  • make coverage

On Windows, things are a little more complicated. Assume ‘P’ is your Python binary (for example C:Python33python.exe).

You must first build the _overlapped.pyd extension and have it placed in the asyncio directory, as follows:

C> P build_ext –inplace

Then you can run the tests as follows:

C> P

And coverage as follows:

C> P –coverage

–Guido van Rossum <>

Trollius name

Extract of :

Trollius is a genus of about 30 species of plants in the family Ranunculaceae, closely related to Ranunculus. The common name of some species is globeflower or globe flower. Native to the cool temperate regions of the Northern Hemisphere, with the greatest diversity of species in Asia, trollius usually grow in heavy, wet clay soils.

Change log

2014-01-08: version 0.1.2

  • Trollius now supports CPython 2.6-3.4, PyPy and Windows. All unit tests pass with CPython 2.7 on Linux.
  • Fix Windows support. Fix compilation of the _overlapped module and add a asyncio._winapi module (written in pure Python). Patch written by Marc Schlaich.
  • Support Python 2.6: require an extra dependency, ordereddict (and unittest2 for unit tests)
  • Support Python 3.2, 3.3 and 3.4
  • Support PyPy 2.2
  • Don’t modify __builtins__ nor the ssl module to inject backported exceptions like BlockingIOError or SSLWantReadError. Exceptions are available in the asyncio module, ex: asyncio.BlockingIOError.

2014-01-06: version 0.1.1

  • Fix asyncio.time_monotonic on Mac OS X
  • Fix create_connection(ssl=True)
  • Don’t export backported SSLContext in the ssl module anymore to not confuse libraries testing hasattr(ssl, “SSLContext”)
  • Relax dependency on the backported concurrent.futures module: use a synchronous executor if the module is missing

2014-01-04: version 0.1

  • First public release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
trollius-0.1.2.tar.gz (138.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page