asyncio-anywhere
Python package that makes it easy to run fast asyncio code
Are you trying to run async code in Python and getting the error
asyncio.run() cannot be called from a running event loop?
This package makes it easy to run asyncio-based async code in tricky execution environments:
- IPython-based notebooks (JupyterLab, AWS Sagemaker, Databricks, etc)
- trio applications
- curio applications
Other Features:
- Use uvloop for faster i/o - but without permanently changing the asyncio event loop policy
- Run any code which uses asyncio I/O.
- Type hints to support type-aware IDEs
Non-Features:
- asyncio-anywhere does not monkey-patch the asyncio module. This avoids unexpected side-effects and potential future bugs.
Usage
pip install asyncio-anywhere
import asyncio
from asyncio_anywhere import asyncio_run
async def myfunc():
await asyncio.sleep(0.01)
return "OK"
result = asyncio_run(myfunc())
print(result)
Use asyncio_run() anywhere where you would normally have run asyncio.run(). Note that it also accepts a boolean debug parameter as the second parameter.
Metadata
Release files for asyncio-anywhere 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| asyncio_anywhere-0.2.0.tar.gz | 3.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asyncio_anywhere-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.9 kB
Release files / asyncio_anywhere-0.2.0.tar.gz
| Download URL | asyncio_anywhere-0.2.0.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5edcf2299978571c35e1b108d8b319a94192bd033037725a191ff317ca0da3c0
|
|
BLAKE2b-256 checksum How to use checksums |
ddb73f112a13354727538147119987dcb77bc619b46c325ea6c96c30c48f0a69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.9.18 Darwin/22.6.0
|
Release files / asyncio_anywhere-0.2.0-py3-none-any.whl
| Download URL | asyncio_anywhere-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9cd0b9c5408dfb1334509f881f027ab118847b55bfd6226377531fbfe144c8be
|
|
BLAKE2b-256 checksum How to use checksums |
5c01533fb8dfb1933676450fb4a8746ad929dcbeebe20faf916870942527c02e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.9.18 Darwin/22.6.0
|