asynchrony
Python asyncio framework for writing safe and fast concurrent code.
Features:
- Type annotated and type safe
- Makes it easy to work with cancellation, errors, and scheduling.
- Well tested and well documented.
- Zero dependency.
- Based on real world experience and pain.
Installation and usage
python3 -m pip install asynchrony
A simple example of starting concurrent tasks for all URLs (maximum 100 tasks at the same time) and waiting for all of them to finish:
from asynchrony import Tasks
async def download_page(url: str) -> bytes:
...
urls = [...]
tasks = Tasks[bytes](timeout=10, max_concurrency=100)
tasks.map(urls, download_page)
try:
pages = await tasks
except Exception:
failed = sum(t.failed for t in tasks)
print(f'{failed} tasks failed')
cancelled = sum(t.cancelled for t in tasks)
print(f'{cancelled} tasks cancelled')
else:
print(f'finished {len(tasks)} tasks')
See tutorial for runnable usage examples.
Release files for asynchrony 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 | |
|---|---|---|---|
| asynchrony-0.2.0.tar.gz | 11.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asynchrony-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.6 kB
Release files / asynchrony-0.2.0.tar.gz
| Download URL | asynchrony-0.2.0.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9589dca3257843294a9965fff2de41a45fd4356e94aeae8587e453b67e23260e
|
|
BLAKE2b-256 checksum How to use checksums |
28f74c9dc1029e4ca6bd3c1893293af653c339ccb8ecee79a73f70416f10e777
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.25.1
|
Release files / asynchrony-0.2.0-py3-none-any.whl
| Download URL | asynchrony-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1823458b27e9eecdd8dd034ae1010fdaa9e51fd44098a417cd7da10b747d4c8
|
|
BLAKE2b-256 checksum How to use checksums |
e22c937b315a4d3600bc7d9c69b6ec83a0c1b04a67d57fed468d308199190233
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.25.1
|