AioDispatch
AioDispatch is a simple and pluggable async dispatcher framework with batteries included. AioDispatch can be used to offload expensive operations to external workers. For example, you might use the framework to send email, execute big queries or analyse large datasets.
AioDispatch is designed to work right of out the box, but to remain pluggable. For example a custom broker is
a matter of subclassing aiodispatch.brokers.abc.Broker and a serializer aiodispatch.serializers.abc.Serializer.
Install
pip install aiodispatch
Usage
import asyncio
from aiodispatch.brokers.memory import MemoryBroker
from aiodispatch.decorators import task
from aiodispatch.dispatch import Dispatcher
from aiodispatch.serializers.json import JsonSerializer
from aiodispatch.worker import Worker
@task()
async def slow_greeter(name: str) -> None:
await asyncio.sleep(2)
print(f"Hello {name}")
async def producer(num: int = 10) -> None:
for i in range(num):
await slow_greeter(name=str(i))
async def main():
broker = MemoryBroker()
serializer = JsonSerializer()
dispatcher = Dispatcher(broker, serializer)
worker = Worker(dispatcher, semaphore=asyncio.Semaphore(1))
async with asyncio.TaskGroup() as tg:
tg.create_task(worker.start())
tg.create_task(producer())
if __name__ == "__main__":
asyncio.run(main())
Metadata
Release files for aiodispatch 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aiodispatch-0.0.2.tar.gz | 6.7 kB | Without provenance | Details for aiodispatch-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiodispatch-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for aiodispatch-0.0.2-py3-none-any.whl |
Total release size: 15.3 kB
Release files / aiodispatch-0.0.2.tar.gz
| Download URL | aiodispatch-0.0.2.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f9af9e17fc53173c216d72f3fa9d227c898aaef1e37c6d65745c339defe7953
|
|
BLAKE2b-256 checksum How to use checksums |
5366715ef55e2150a52051aa69e439405e65453277c771c9fd1fb12d67c0eb91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.0 CPython/3.11.0 Linux/5.15.0-1033-azure
|
Release files / aiodispatch-0.0.2-py3-none-any.whl
| Download URL | aiodispatch-0.0.2-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ccc242ad6fb6bfdce8d2fb384671af560aa03dcd6c5588b1e87377560f196a3
|
|
BLAKE2b-256 checksum How to use checksums |
f6d2cc9e65856406af4be899c7905913d9d0e9b3d62a3b9e48afacf63972a709
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.0 CPython/3.11.0 Linux/5.15.0-1033-azure
|
Security for aiodispatch 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.