aioconcurrency 
Run a coroutine with each item in an iterable, concurrently
Install
pip install aioconcurrency
Usage example
import aioconcurrency
items = [1, 2, 3, 4]
async def f(item):
return item * 2
async def main():
await aioconcurrency.map(items, f, concurrency=2) # Returns [2, 4, 6, 8]
async for result in aioconcurrency.each(items, f, concurrency=2):
print(result) # Prints 2 4 6 8 in random order
Api
aioconcurrency.map
Runs the given coroutine concurrently with each item in an iterable. The list of the return values will be ordered as if ran serially.
items
An iterable object.
coro
Coroutine to feed each item to.
optional: concurrency
Number of concurrent runs of coro. Defaults to aioconcurrency.Infinite.
optional: executor
Can be an instance of ThreadPoolExecutor.
optional: loop
The asyncio event loop that will be used.
aioconcurrency.each
Runs the given coroutine concurrently with each item in an iterable. Returns a generator that may be used to iterate over the return values. The generator yields values as soon as they are available.
items
An iterable object. If an asyncio.Queue is passed then .each will read from it indefinitely.
coro
Coroutine to feed each item to.
optional: concurrency
Number of concurrent runs of coro. Defaults to aioconcurrency.Infinite.
optional: executor
Can be an instance of ThreadPoolExecutor.
optional: loop
The asyncio event loop that will be used.
optional: discard_results
If truthy, discard the return value of coro. Defaults to false.
property: wait()
Coroutine. May be used to wait until all items have been processed.
property: processed_count
The number of items that have been processed so far.
property: cancel()
Cancels all runs of coro.
Tests
pytest .
Metadata
Release files for aioconcurrency 0.5.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 | Provenance | Actions |
|---|---|---|---|---|
| aioconcurrency-0.5.0.tar.gz | 4.1 kB | Without provenance | Details for aioconcurrency-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aioconcurrency-0.5.0-py3.7.egg | Legacy Egg format | - | - | Details for aioconcurrency-0.5.0-py3.7.egg |
Total release size: 11.1 kB
Release files / aioconcurrency-0.5.0.tar.gz
| Download URL | aioconcurrency-0.5.0.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fcc18102d6ec3c25a3fd6b3b361e257ffb9f71a9931a097bfc374d269dc6fd57
|
|
BLAKE2b-256 checksum How to use checksums |
75ed0a57be8ee3afcef3da04b7374f9522bdb31ddeac4d2c74c604962c01e50f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.7.5
|
Release files / aioconcurrency-0.5.0-py3.7.egg
| Download URL | aioconcurrency-0.5.0-py3.7.egg |
|---|---|
| Size | 7.0 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
4516c7a05baddcd73047365927f3e25c24404ea1db760b1788ef9c198be8e467
|
|
BLAKE2b-256 checksum How to use checksums |
f0436867ce1d07c2cc4bb3c72f237ee647ba3b195a60d39030027eeaa0071ab2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.7.5
|
Security for aioconcurrency 0.5.0
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.