Skip to main content

anyio-contextgroup

anyio-contextgroup is a utiliity mechanism for establishing an anchored async context. This allows ExitStack-like behavior while maintaining structured concurrency. It works by running all context operations within a parent, outermost TaskGroup.

Getting started

Available as anyio-contextgroup on pypi.

At a glance

from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager

from anyio_contextgroup import create_context_group


@asynccontextmanager
async def my_ctx(val: str) -> AsyncGenerator[int, None]:
    try:
        yield len(val)
    finally:
        print(f'{val=}')


async def main():
    async with create_context_group() as ctx_group:
        # Do some stuff
        ...

        for _ in range(5):
            ctx_retval = await ctx_group.enter_async_context(my_ctx, 'foo')
            assert ctx_retval == 3  # len('foo')

        # Do some other stuff
        ...

        # Now the context group will close, calling ``print()`` from ``my_ctx``

Metadata

Release files for anyio-contextgroup 2026.4.14.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anyio-contextgroup 2026.4.14.0
File Size Uploaded Provenance
anyio_contextgroup-2026.4.14.0.tar.gz 3.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for anyio-contextgroup 2026.4.14.0
File Interpreter ABI Platform
anyio_contextgroup-2026.4.14.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.6 kB

Release files / anyio_contextgroup-2026.4.14.0.tar.gz

Download URL anyio_contextgroup-2026.4.14.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
471c6acaae4e928ae4ffce1a92ccffba14f914d2abd285227557b8d17c786dc9
BLAKE2b-256 checksum
How to use checksums
063f5f02a0895078330d4bb54eb43d0c7ed248346179482c9d25fe14b67c27bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 14, 2026.

Transparency log

Release files / anyio_contextgroup-2026.4.14.0-py3-none-any.whl

Download URL anyio_contextgroup-2026.4.14.0-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
62bb86edc801277de1f4cf48dd9e10ee509ae551ebdc216e009921770164015e
BLAKE2b-256 checksum
How to use checksums
7ba36ad20c30b56b1d71902fea915f931443a4369c2207efa6f69520752bab9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 14, 2026.

Transparency log

Security for anyio-contextgroup 2026.4.14.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for anyio_contextgroup-2026.4.14.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page