aiotools
Idiomatic asyncio utilities
What it is and what it does
aiotools is a collection of utilities designed to make asyncio programming more ergonomic and safer. It provides structured cancellation primitives (cancel_and_wait), async context manager decorators (@actxmgr), task lifecycle management (TaskScope), and server daemon patterns with automatic signal handling. The package targets vanilla asyncio and couples tightly with asyncio internals, making it most suitable for projects already committed to the standard library's async ecosystem.
The library addresses common pain points in asyncio code: coordinating cancellation without ambiguity about whether to re-raise CancelledError, writing async context managers without boilerplate classes, managing groups of concurrent tasks that complete even when siblings fail, and launching multi-process server daemons with proper lifecycle and signal handling. It depends only on async-lru and requires Python 3.11+, keeping the dependency footprint minimal.
Use it for:
- Implement safe task cancellation in asyncio applications without manual CancelledError handling logic.
- Build async context managers and resource cleanup patterns using the @actxmgr decorator.
- Manage concurrent task groups where all tasks must run to completion unless explicitly cancelled.
- Launch multi-process asyncio server daemons with automatic SIGINT/SIGTERM handling.
- Create repeating async timers that can be cleanly cancelled and awaited to completion.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
aiotools provides idiomatic asyncio utilities for structured concurrency, safe task cancellation, async context managers, and server lifecycle management in Python 3.11+.
Yes, if you are building asyncio applications on Python 3.11+ and want structured concurrency patterns and safer cancellation semantics. The low install friction, active maintenance, MIT license, and zero known vulnerabilities make it a solid choice. Not necessary if you are using trio, anyio, or other async frameworks, or if you prefer managing task lifecycle manually.
Install
aiotools on PyPI
pip
pip install aiotoolsuv
uv add aiotoolspoetry
poetry add aiotoolsInstalling aiotools
Before you install
Low install friction with a single lightweight runtime dependency (async-lru). Active maintenance with a release within the last month and consistent Python 3.11+ support.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal obligations.
Quickstart
pip install aiotools
import asyncio
import aiotools
async def main():
task = asyncio.create_task(asyncio.sleep(1))
await aiotools.cancel_and_wait(task)
asyncio.run(main())
Requires Python 3.11 or later; relies on asyncio internals so compatibility is tied to CPython versions.
Verify before relying
- Whether TaskScope exception handling is suitable for production long-running servers without manual result tracking.
- Performance characteristics when managing hundreds or thousands of concurrent tasks.
- Compatibility with asyncio subclasses or alternative event loop implementations.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — async-lru |
| Maintenance | actively maintained — 24 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 351,681/month — #7,321 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: aiotools-2.2.4-py3-none-any.whl
Keywords: asyncio
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
aiojobsaiojobs provides a scheduler for spawning and…
permissive · top 15,000 on PyPI
aiometeraiometer is a concurrency scheduling library…
permissive · top 15,000 on PyPI
aiorunProvides a simplified entry point for asyncio…
permissive · top 15,000 on PyPI
aiomonitorAdds a concurrent monitor and interactive…
permissive · top 15,000 on PyPI
async-timeoutProvides an asyncio-compatible timeout context…
permissive · top 1,000 on PyPI
wait-for2Provides an alternate implementation of…
permissive · top 15,000 on PyPI
async-exit-stackProvides AsyncExitStack, a backport of Python…
permissive · top 15,000 on PyPI
aiologicaiologic provides thread-aware and async-aware…
permissive · top 5,000 on PyPI
taskgroupBackports asyncio.TaskGroup, asyncio.Runner,…
permissive · top 5,000 on PyPI
aiomcacheAsyncio-based memcached client providing…
permissive · top 15,000 on PyPI