mode.loop

AsyncIO event loop implementations.

This contains a registry of different AsyncIO loop implementations to be used with Mode.

The choices available are:

aio default

Normal asyncio event loop policy.

eventlet

Use :pypi:`eventlet` as the event loop.

This uses :pypi:`aioeventlet` and will apply the :pypi:`eventlet` monkey-patches.

To enable execute the following as the first thing that happens when your program starts (e.g. add it as the top import of your entrypoint module):

>>> import mode.loop
>>> mode.loop.use('eventlet')
gevent

Use :pypi:`gevent` as the event loop.

This uses :pypi:`aiogevent` (+modifications) and will apply the :pypi:`gevent` monkey-patches.

This choice enables you to run blocking Python code as if they have invisible async/await syntax around it (NOTE: C extensions are not usually gevent compatible).

To enable execute the following as the first thing that happens when your program starts (e.g. add it as the top import of your entrypoint module):

>>> import mode.loop
>>> mode.loop.use('gevent')
uvloop

Event loop using :pypi:`uvloop`.

To enable execute the following as the first thing that happens when your program starts (e.g. add it as the top import of your entrypoint module):

>>> import mode.loop
>>> mode.loop.use('uvloop')
mode.loop.use(loop: str) None

Specify the event loop to use as a string.

Loop must be one of: aio, eventlet, gevent, uvloop.