Decorator that turns async generator functions into async context managers.
Decorator that turns async generator functions into async context managers.
Supported versions of python: 3.6+
(since async generators were introduced in python 3.6)
pip install asyncio-contextmanager
Usage is straightforward and simple:
from aiocontext import async_contextmanager
@async_contextmanager
async def foo():
yield 'Foo!'