skip to navigation
skip to content

Not Logged In

trollius 0.1.5

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

Latest Version: 0.2

Trollius is a portage of the Tulip project (asyncio module, PEP 3156) on Python 2. Trollius works on Python 2.6-3.4. It has been tested on Windows, Linux, Mac OS X, FreeBSD and OpenIndiana.

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 'https://bitbucket.org/enovance/trollius#trollius'

Runtime Dependencies

The futures project is needed on Python 2 to get a backport of concurrent.futures. https://pypi.python.org/pypi/futures

Python 2.6 requires also ordereddict: https://pypi.python.org/pypi/ordereddict

Test Dependencies

Unit tests require the mock module: https://pypi.python.org/pypi/mock

Python 2.6 requires also unittest2: https://pypi.python.org/pypi/unittest2

Differences between Trollius and Tulip

  • Trollius coroutines use "yield" and "raise Return(value)", whereas Tulip coroutines use "yield from" and "return". "return x, y" must be converted to "raise Return(x, y)".
  • 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, no SNI, etc. The SSL transport has "compression" extra info in Python 2.
  • 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.
  • asyncio.subprocess has no DEVNULL constant

Usage

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 (it will be placed in the asyncio directory):

C> P setup.py build_ext

Then you can run the tests as follows:

C> P runtests.py

And coverage as follows:

C> P runtests.py --coverage

--Guido van Rossum <guido@python.org>

Backports

To support Python 2.6-3.4, many Python modules of the standard library have been backported:

Name Python Backport
OSError 3.3 asyncio.py33_exceptions
_overlapped 3.4 asyncio._overlapped
_winapi 3.3 asyncio.py33_winapi
collections.OrderedDict 2.7, 3.1 ordereddict (PyPI)
selectors 3.4 asyncio.selectors
ssl 3.2, 3.3 asyncio.py3_ssl
time.monotonic 3.3 asyncio.time_monotonic
unittest 2.7, 3.1 unittest2 (PyPI)
unittest.mock 3.3 mock (PyPI)
weakref.WeakSet 2.7, 3.0 asyncio.py27_weakrefset

Trollius name

Extract of http://en.wikipedia.org/wiki/Trollius :

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-02-10: version 0.1.5

  • Merge with Tulip 0.3.1:
    • New asyncio.subprocess module
    • _UnixWritePipeTransport now also supports character devices, as _UnixReadPipeTransport. Patch written by Jonathan Slenders.
    • StreamReader.readexactly() now raises an IncompleteReadError if the end of stream is reached before we received enough bytes, instead of returning less bytes than requested.
    • poll and epoll selectors now round the timeout away from zero (instead of rounding towards zero) to fix a performance issue
    • asyncio.queue: Empty renamed to QueueEmpty, Full to QueueFull
    • _fatal_error() of _UnixWritePipeTransport and _ProactorBasePipeTransport don't log BrokenPipeError nor ConnectionResetError
    • Future.set_exception(exc) now instanciate exc if it is a class
    • streams.StreamReader: Use bytearray instead of deque of bytes for internal buffer
  • Fix test_wait_for() unit test

2014-01-22: version 0.1.4

  • The project moved to https://bitbucket.org/enovance/trollius
  • Fix CoroWrapper (_DEBUG=True): add missing import
  • Emit a warning when Return is not raised
  • Merge with Tulip to get latest Tulip bugfixes
  • Fix dependencies in tox.ini for the different Python versions

2014-01-13: version 0.1.3

  • Workaround bugs in the ssl module of Python older than 2.6.6. For example, Mac OS 10.6 (Snow Leopard) uses Python 2.6.1.
  • return x, y is now written raise Return(x, y) instead of raise Return((x, y))
  • Support "with (yield lock):" syntax for Lock, Condition and Semaphore
  • SSL support is now optional: don't fail if the ssl module is missing
  • Add tox.ini, tool to run unit tests. For example, "tox -e py27" creates a virtual environment to run tests with Python 2.7.

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
 
File Type Py Version Uploaded on Size
trollius-0.1.5-py27-none-any.whl (md5) Python Wheel 2.7 2014-02-10 87KB
trollius-0.1.5.tar.gz (md5) Source 2014-02-10 154KB
  • Downloads (All Versions):
  • 107 downloads in the last day
  • 638 downloads in the last week
  • 2896 downloads in the last month