taskgroup
backport of asyncio.TaskGroup, asyncio.Runner and asyncio.timeout
What it is and what it does
TaskGroup is a backport of Python 3.12.8's structured concurrency primitives to older Python versions. It provides TaskGroup (for managing groups of concurrent tasks with unified exception handling), Runner (a context manager for running async code), and timeout (for enforcing time limits on async operations). The implementation works by temporarily replacing the current asyncio.Task with a subclass that adds uncancel and context-setting support, allowing most of asyncio's C-accelerated behavior to remain intact.
This package is useful when you want to write modern async code using Python 3.12's concurrency patterns but need to support older Python environments. It depends on exceptiongroup and typing_extensions to bridge compatibility gaps.
Use it for:
- Write async code using TaskGroup syntax on older Python versions without waiting for a platform upgrade.
- Manage multiple concurrent tasks with automatic exception aggregation and cleanup across Python versions.
- Add timeout enforcement to async operations on Python versions that lack native asyncio.timeout.
- Migrate legacy async codebases to structured concurrency patterns while maintaining backward compatibility.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Backports asyncio.TaskGroup, asyncio.Runner, and asyncio.timeout from Python 3.12.8 to Python 3.8–3.11, enabling structured concurrency patterns on older Python versions.
Yes, if you need TaskGroup or timeout on Python versions prior to 3.12. The package is lightweight, permissively licensed, actively maintained, has no known vulnerabilities, and solves a real compatibility gap. Use conditional imports to avoid redundancy on Python 3.12+.
Install
taskgroup on PyPI
pip
pip install taskgroupuv
uv add taskgrouppoetry
poetry add taskgroupInstalling taskgroup
Before you install
Low install friction; pure Python wheel with only two lightweight runtime dependencies (exceptiongroup and typing_extensions). Repository is active with a recent release (2025-01-03) and no archived status.
License in practice
MIT license (permissive); you can use this in commercial and proprietary projects with minimal restrictions, provided you include the license notice.
Quickstart
from taskgroup import TaskGroup, timeout, run
async def main():
async with TaskGroup() as group:
group.create_task(some_coroutine())
run(main())
Requires Python 3.8 or later; asyncio event loop must be available.
Verify before relying
- Whether the backport maintains full API and behavior parity with Python 3.12.8 TaskGroup in edge cases.
- Performance characteristics compared to native asyncio.TaskGroup in Python 3.12+.
- Whether uncancel and context-setting behavior is fully compatible with all asyncio patterns.
- Exact Python version support range (description mentions 3.8–3.11 but requires_python is unspecified).
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — exceptiongroup, typing_extensions |
| Maintenance | actively maintained — 588 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,771,696/month — #2,895 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: taskgroup-0.2.2-py2.py3-none-any.whl
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
backports.asyncio.runnerProvides the Python 3.11 asyncio.Runner context…
permissive · top 1,000 on PyPI
subprocess32A backport of Python 3's subprocess module to…
permissive · top 15,000 on PyPI
aiocontextvarsProvides asyncio support for the contextvars…
permissive · top 15,000 on PyPI
aiotoolsaiotools provides idiomatic asyncio utilities…
permissive · top 15,000 on PyPI
async-interruptProvides an asyncio context manager that…
permissive · top 5,000 on PyPI
asyncioThis package is an obsolete backport of…
permissive · top 1,000 on PyPI
threadedProvides decorators to wrap functions for…
permissive · top 15,000 on PyPI
backports.tempfileProvides the TemporaryDirectory context manager…
permissive · top 5,000 on PyPI
futuresBackport of Python 3's concurrent.futures…
permissive · top 5,000 on PyPI
contextlib2contextlib2 backports the Python standard…
permissive · top 5,000 on PyPI