Skip to main content

Some convenient utilities for asyncio

Project description

asyncio-addon

PyPI version Python versions

Some convenient utilities for asyncio.

Utilities include:

  • @async_main: A decorator to run an async function as the main entry point.
  • run_sync: Run a coroutine in sync, even if the async event loop is running.
  • run_async: An alias of asyncio.to_thread. Run a sync function in a separate thread.
  • SemGroup: A task group with a semaphore, allowing limited concurrency.
  • gather_all: Enhanced version of asyncio.gather with concurrency control, better API and cancel-safety.

(Almost) everything natively include timeout control.

Why do we need another gather_all?

As the doc says:

A new alternative to create and run tasks concurrently and wait for their completion is asyncio.TaskGroup. TaskGroup provides stronger safety guarantees than gather for scheduling a nesting of subtasks: if a task (or a subtask, a task scheduled by a task) raises an exception, TaskGroup will, while gather will not, cancel the remaining scheduled tasks.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asyncio_addon-0.3.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asyncio_addon-0.3.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file asyncio_addon-0.3.0.tar.gz.

File metadata

  • Download URL: asyncio_addon-0.3.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for asyncio_addon-0.3.0.tar.gz
Algorithm Hash digest
SHA256 22d19dcf8b8a9b1896e69eff3f7f4da4b73dc8f86613b862492921c4f5bdab18
MD5 3a78bca532665ee53d888e3d48092069
BLAKE2b-256 3efcc677c78922a0e2bc994a1833357460b733f82d036ed5fe551bc6fb74de01

See more details on using hashes here.

Provenance

The following attestation bundles were made for asyncio_addon-0.3.0.tar.gz:

Publisher: publish-to-pypi.yml on observerw/asyncio-addon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file asyncio_addon-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: asyncio_addon-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for asyncio_addon-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 447c9fcf80d9dbd28de7aa49901b06a6b5c26275cc7ee3e0f163d17ea55f8ff8
MD5 3475ea26ca4ee7113ce0ba61e8b8c642
BLAKE2b-256 5c32459f435e56a0e1b05beeda41c5f6813a8783f97990720e9e8b6b170bb90e

See more details on using hashes here.

Provenance

The following attestation bundles were made for asyncio_addon-0.3.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on observerw/asyncio-addon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page