Skip to content

hellysmile/asyncio_monkey

Repository files navigation

asyncio_monkey

info:monkey patch asyncio modules for expected behaviour

Installation

pip install asyncio_monkey

Usage

# 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

# 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
  • Disables get_event_loop returns currently running loop, even if MainThread loop is None, docs , source
  • Disables silent destroying futures inside asyncio.gather source
  • Prevents asyncio.Lock deadlock after cancellation source

About

monkey patch asyncio modules for expected behaviour

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages