skillfed

taskgroup

backport of asyncio.TaskGroup, asyncio.Runner and asyncio.timeout

taskgroup v0.2.2 2.8M downloads/30d#2,895 on PyPI10
Permissive license Active released

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 taskgroup

uv

uv add taskgroup

poetry

poetry add taskgroup

Installing 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

License :: OSI Approved :: MIT License

Tags

asyncio taskgroup backportstructured concurrency pythonasyncio runner timeoutpython 3.8 taskgroupasync task managementasyncio context managerconcurrent task groups
asynciobackportconcurrency

More Software Development packages