Skip to main content

monkey patch asyncio modules for expected behaviour

Project description

asyncio_monkey
==============

:info: monkey patch asyncio modules for expected behaviour

.. image:: https://img.shields.io/travis/wikibusiness/asyncio_monkey.svg
:target: https://travis-ci.org/wikibusiness/asyncio_monkey

.. image:: https://img.shields.io/pypi/v/asyncio_monkey.svg
:target: https://pypi-hypernode.com/pypi/asyncio_monkey

Installation
------------

.. code-block:: shell

pip install asyncio_monkey

Usage
-----

.. code-block:: python

# it must be done before any import asyncio statement, once per project
# best place is __init__.py of You'r application
from asyncio_monkey import patch_all # noqa isort:skip
patch_all()

or call the one you need

.. code-block:: python

# it must be done before any import asyncio statement, once per project
# best place is __init__.py of You'r application
import asyncio_monkey # noqa isort:skip

asyncio_monkey.patch_gather()
asyncio_monkey.patch_log_destroy_pending()
asyncio_monkey.patch_get_event_loop()
asyncio_monkey.patch_lock()

Features
--------

- Cancel pending tasks `gather` if any task fails, `source <https://bugs.python.org/issue31452>`_

- Disables `get_event_loop` returns currently running loop, even if `MainThread` loop is `None`, `docs <https://docs.python.org/3/library/asyncio-eventloops.html#asyncio.get_event_loop>`_ , `source <https://bugs.python.org/issue28613>`_

- Disables silent destroying futures inside `asyncio.gather` `source <https://github.com/python/cpython/blob/3dc7c52a9f4fb83be3e26e31e2c7cd9dc1cb41a2/Lib/asyncio/tasks.py#L600>`_

- Prevents `asyncio.Lock` deadlock after cancellation `source <http://bugs.python.org/issue27585>`_

Project details


Download files

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

Source Distribution

asyncio_monkey-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file asyncio_monkey-0.1.0.tar.gz.

File metadata

File hashes

Hashes for asyncio_monkey-0.1.0.tar.gz
Algorithm Hash digest
SHA256 99b1b82942dc48be2aab2898fdbbf59ee88c1cce87dc6ba111792dc14a4502b2
MD5 01e8509411aee32b7cf50318deb55257
BLAKE2b-256 5949ed46718a467bde366f5d8ce6a8d42742cb0060761e614e16ac2eb7d7b580

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page