async-iterator
Easy way to use async iterator without take care about asyncio’s TaskGroup.
Documentation: https://async-iterator.lpthong90.dev
Source Code: https://github.com/lpthong90/async-iterator
The package helps to use async iterator without take care about asyncio's taskgroup.
Installation
$ pip install async-iterator
---> 100%
Successfully installed async-iterator
Basic Usage
import asyncio
import time
from async_iterator import aiter, siter
inputs = [1, 2, 3]
async def afunc(it: int) -> int:
await asyncio.sleep(2)
return it + 1
def sfunc(it: int) -> int:
time.sleep(2)
return it + 1
async def amain():
return await aiter(afunc)(inputs)
def smain():
return siter(sfunc)(inputs)
if __name__ == "__main__":
format = "%Y-%m-%d %H:%M:%S"
print(time.strftime(format))
print("async", asyncio.run(amain())) # it takes ~2 seconds
print(time.strftime(format))
print("sync", smain()) # it takes ~6 seconds
print(time.strftime(format))
Output
2024-01-06 00:58:54
async [2, 3, 4]
2024-01-06 00:58:56
sync [2, 3, 4]
2024-01-06 00:59:02
License
This project is licensed under the terms of the MIT license.
Metadata
Release files for async-iterator 0.1.1
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 |
|---|---|---|---|---|
| async_iterator-0.1.1.tar.gz | 2.8 kB | Without provenance | Details for async_iterator-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| async_iterator-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for async_iterator-0.1.1-py3-none-any.whl |
Total release size: 6.2 kB
Release files / async_iterator-0.1.1.tar.gz
| Download URL | async_iterator-0.1.1.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
645699396d24ee15f26b8ac5d7b7d390b1afad1ede2eb615a37f37a4285cd9ac
|
|
BLAKE2b-256 checksum How to use checksums |
e03293fd654d31835e3df7bd0071878e9eea7158ee6a47459c8d1ee5553629ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.8.18 Linux/6.2.0-1018-azure
|
Release files / async_iterator-0.1.1-py3-none-any.whl
| Download URL | async_iterator-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3d79b6306932ee71bf4436f2ea488eea31afb5c522094f2764e788713782c1f4
|
|
BLAKE2b-256 checksum How to use checksums |
fefde6732dda81829c614f61fae92425fd24b3593afbe38a34e350c14fca7a69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.8.18 Linux/6.2.0-1018-azure
|
Security for async-iterator 0.1.1
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.