Skip to content

Latest commit

 

History

History
187 lines (105 loc) · 4.5 KB

index.rst

File metadata and controls

187 lines (105 loc) · 4.5 KB

Trololio: Trollius and asyncio compatibility library

trololio

Trololio allows your program to have a soft dependency on trollius in Python versions where py3:asyncio (aka Tulip) is part of the standard library.

Trololio provides a compatibility layer for Trollius and asyncio, it addresses the differences listed in Trollius and Tulip:

  • Allows the use of Trollius' syntax with py3:asyncio.
  • Provides missing objects and aliases for the others.
  • Synchronizes debug environment variables.

Documentation for Trollius and py3:asyncio.

Indices and tables

  • genindex
  • search

Converting Code

  1. If your code was written for asyncio, convert it to use Trollius.
  2. Change your trollius imports:

    - from trollius import coroutine, From, Return
    + from trololio import coroutine, From, Return
    
    - import trollius
    + from trololio import asyncio
  3. If you used the second import style:

    - trollius.*
    + [trololio.]asyncio.*
note

Make sure you use coroutine, From and Return from trololio and not asyncio. Otherwise an ImportError will be raised when running with py3:asyncio (Tulip).

Module contents

ASYNCIO

A boolean indicating if asyncio (trololio's submodule) is py3:asyncio (Tulip).

TROLLIUS

A boolean indicating if asyncio (trololio's submodule) is trollius:trollius.

ASYNCIO and TROLLIUS are always of opposite value.

Trollius objects

The following objects are aliases for the trollius:trollius ones, or defined by trololio.

coroutine

trollius:trollius.coroutine or equivalent allowing yield From(x).

From

trollius:trollius.From or equivalent.

Return

trollius:trollius.Return or equivalent.

BACKPORT_SSL_ERRORS

trollius:trollius.BACKPORT_SSL_ERRORS or False.

BACKPORT_SSL_CONTEXT

trollius:trollius.BACKPORT_SSL_CONTEXT or False.

Standard library objects

The following objects are aliases for the trollius:trollius ones, or aliases for the standard library ones.

OSError and socket.error exceptions

BlockingIOError

trollius:trollius.BlockingIOError or py3:BlockingIOError.

BrokenPipeError

trollius:trollius.BrokenPipeError or py3:BrokenPipeError.

ChildProcessError

trollius:trollius.ChildProcessError or py3:ChildProcessError.

ConnectionAbortedError

trollius:trollius.ConnectionAbortedError or py3:ConnectionAbortedError.

ConnectionRefusedError

trollius:trollius.ConnectionRefusedError or py3:ConnectionRefusedError.

ConnectionResetError

trollius:trollius.ConnectionResetError or py3:ConnectionResetError.

FileNotFoundError

trollius:trollius.FileNotFoundError or py3:FileNotFoundError.

InterruptedError

trollius:trollius.InterruptedError or py3:InterruptedError.

PermissionError

trollius:trollius.PermissionError or py3:PermissionError.

SSLError

SSLEOFError

trollius:trollius.SSLEOFError or py3:ssl.SSLEOFError.

SSLWantReadError

trollius:trollius.SSLWantReadError or py3:ssl.SSLWantReadError.

SSLWantWriteError

trollius:trollius.SSLWantWriteError or py3:ssl.SSLWantWriteError.

SSLContext

trollius.SSLContext or py3:ssl.SSLContext.

asyncio submodule

asyncio

Trololio provides the asyncio submodule. It is either trollius:trollius, the first choice, or py3:asyncio (Tulip), the fallback.

note

If neither module was found, an ImportError is raised.