skillfed

aiotools

Idiomatic asyncio utilities

aiotools v2.2.4 351.7K downloads/30d#7,321 on PyPI167
Permissive license MIT Active released

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 aiotools

uv

uv add aiotools

poetry

poetry add aiotools

Installing 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

Development Status :: 5 - Production/StableFramework :: AsyncIOIntended Audience :: DevelopersProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development

Tags

asyncio utilitiesstructured concurrencysafe task cancellationasync context managersasyncio server patternstaskscope taskgroupasync defer cleanup
asynciostructured-concurrencytask-management

More Software Development packages