aioutilities
asyncio-powered coroutine worker pool. No more juggling bounded semaphores and annoying timeouts, and allows you to run through millions of pieces of data efficiently.
Installation
python -m pip install -U aioutilities
Credits
This is refactored and built on top of https://github.com/CaliDog/asyncpool
Example Usage
from asyncio import Queue, ensure_future, run, sleep
from aioutilities.pool import AioPool
async def example_coro(initial_number: int, result_queue: Queue[int]) -> None:
result = initial_number * 2
print(f"Processing Value! -> {initial_number} * 2 = {result}")
await sleep(1)
await result_queue.put(initial_number * 2)
async def result_reader(queue: Queue[int | None]) -> None:
while True:
value = await queue.get()
if value is None:
break
print(f"Got value! -> {value}")
async def example() -> None:
result_queue = Queue[int | None]()
reader_future = ensure_future(result_reader(result_queue))
# Start a worker pool with 10 coroutines, invokes `example_coro` and waits for
# it to complete or 5 minutes to pass.
pool = AioPool[int](
name="ExamplePool",
task=example_coro,
worker_qty=10,
timeout=300,
)
async with pool.spawn() as workers:
for i in range(50):
await workers.push(i, result_queue)
await result_queue.put(None)
await reader_future
def run_example() -> None:
run(example())
Metadata
Release files for aioutilities 1.0.3
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 |
|---|---|---|---|---|
| aioutilities-1.0.3.tar.gz | 5.4 kB | Without provenance | Details for aioutilities-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aioutilities-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for aioutilities-1.0.3-py3-none-any.whl |
Total release size: 13.6 kB
Release files / aioutilities-1.0.3.tar.gz
| Download URL | aioutilities-1.0.3.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e12976c2a103e3bff3a5fb03223627bdaa53df2650c1a36591cb9ad9235b89f3
|
|
BLAKE2b-256 checksum How to use checksums |
b11a9707bc92231df50b78515917d54f30714a4ef9214838afa92f8e909957e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.14 CPython/3.10.6 Darwin/21.6.0
|
Release files / aioutilities-1.0.3-py3-none-any.whl
| Download URL | aioutilities-1.0.3-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02c9152ad1045a06b4866d916739cb5fc12a01cbdc4e59376da55874d840b03e
|
|
BLAKE2b-256 checksum How to use checksums |
e2f2a0099694168129ff1f4fbe1ac4fdb3ec489bd3fbfebb83d94577c7776361
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.14 CPython/3.10.6 Darwin/21.6.0
|
Security for aioutilities 1.0.3
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.