No project description provided
Project description
Extra Async
Utilities for Python Asynchronous programming
aenumerate
Asynchronous version of Python's "enumerate". Just pass an async-iterator where the iterator would be, and use it in an async-for.
usage:
import asyncio
from extraasync import aenumerate
async def paused_pulses(n, message="pulse", interval=0.1):
for i in range(n):
asyncio.sleep(interval)
yield message
async def main():
for index, message in aenumerate(paused_pulses(5)):
print(index, message)
asyncio.run(main())
ExtraTaskGroup
An asyncio.TaskGroup subclass that won't cancel all tasks when any of them errors out.
The hardcoded behavior of asyncio.TaskGroup is that when any exception is raised in any of the taskgroup tasks, all sibling incomplete tasks get cancelled immediatelly.
With ExtraTaskGroup, all created tasks are run to completion, and any exceptions are bubbled up as ExceptionGroups on the host task.
import asyncio
from extraasync import ExtraTaskGroup
async def worker(n):
await asyncio.sleep(n/10)
if n % 3 == 0:
raise RuntimeError()
return n
async def main():
try:
async with ExtraTaskGroup() as tg:
tasks = [tg.create_task(worker(i)) for i in range(10)]
except *RuntimeError as exceptions:
print(exceptions)
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file extraasync-0.2.0.tar.gz
.
File metadata
- Download URL: extraasync-0.2.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4aaeaa8db55b9c75c411111fc1f9d6c326f65efb9d2b04282faaad97874cdf66 |
|
MD5 | dea0071d6e6ad53a73591b85e699e559 |
|
BLAKE2b-256 | af117aef6de765c5a5ecc80eb2e6f0c4b57eb7090621f683b3a323b577c9f9fc |
Provenance
The following attestation bundles were made for extraasync-0.2.0.tar.gz
:
Publisher:
pypi.yml
on jsbueno/extraasync
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
extraasync-0.2.0.tar.gz
- Subject digest:
4aaeaa8db55b9c75c411111fc1f9d6c326f65efb9d2b04282faaad97874cdf66
- Sigstore transparency entry: 149203285
- Sigstore integration time:
- Predicate type:
File details
Details for the file extraasync-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: extraasync-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 838618f34fd7c406eacb22e717c8071d2be8a8432f3270b244fa633fb7f12311 |
|
MD5 | 49bda39fa61a581cc419dec328ee1825 |
|
BLAKE2b-256 | 6a0595faf6dbbf3d97f9303619bf8a97a252a59c51f67a1716ac1cb0a369a995 |
Provenance
The following attestation bundles were made for extraasync-0.2.0-py3-none-any.whl
:
Publisher:
pypi.yml
on jsbueno/extraasync
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
extraasync-0.2.0-py3-none-any.whl
- Subject digest:
838618f34fd7c406eacb22e717c8071d2be8a8432f3270b244fa633fb7f12311
- Sigstore transparency entry: 149203287
- Sigstore integration time:
- Predicate type: