--- id: trio-typing version: "0.10.0" license: MIT -or- Apache License 2.0 license_treatment: permissive maintenance: dormant --- # trio-typing — Static type checking support for Trio and related projects License: permissive · Maintenance: dormant · Downloads: 1.4M/mo ## What it is and what it does trio-typing is a collection of PEP 561 type stubs and typing utilities for the Trio async ecosystem. It provides type information for trio, outcome, and async_generator packages so that mypy can type-check code using these libraries. The package also exports runtime types like TaskStatus[T] and AsyncGenerator[YieldT, SendT] that Trio programs often need to reference in their own type annotations. The package includes an optional mypy plugin that enhances type checking by inferring specific return types for trio.open_file() based on mode and buffering arguments, reducing boilerplate for functions that take callable-and-args patterns, and providing full type support for @async_generator decorated functions. Runtime dependencies include trio, typing-extensions, mypy-extensions, async-generator, packaging, and importlib-metadata. Use it for: - Add static type checking to an existing Trio application by installing the stubs and mypy plugin to catch type errors before runtime. - Define task status types in Trio nursery.start() calls using TaskStatus[T] to ensure type safety across async task boundaries. - Type-check @async_generator decorated functions with full yield, send, and return type inference when using the mypy plugin. - Provide type hints for async generator functions that yield and accept values, using the backported AsyncGenerator type on older Python versions. - Reduce type-checking boilerplate in Trio libraries by using the @takes_callable_and_args decorator to validate variadic function signatures. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides PEP 561 type stubs and typing utilities for Trio async framework, enabling static type checking with mypy for Trio, outcome, and async_generator packages. Yes, if you are actively developing Trio code and want static type checking. The package is stable, permissively licensed, and has no known vulnerabilities. However, maintenance is dormant (last release 2023-12-01), so verify that the type stubs remain accurate for your Trio version before relying on it for new projects. The mypy plugin requires mypy 1.0+ and CPython for type checking. ## Install pip install trio-typing uv add trio-typing poetry add trio-typing ## Installing trio-typing Before you install: Low install friction with a pure-wheel distribution. Maintenance is dormant—last release was 2023-12-01 and no commits since 2024-10-24—but the package remains archived-free and has no known vulnerabilities, making it stable for existing Trio codebases. License in practice: Dual-licensed under MIT or Apache License 2.0 (permissive), so you may choose either license when incorporating this package into your own projects. Quickstart: pip install trio-typing from trio_typing import TaskStatus async def my_task(*, task_status: TaskStatus[str]): task_status.started("ready") Type checking requires mypy on CPython; install trio-typing[mypy] and add 'plugins = trio_typing.plugin' to mypy.ini to enable the plugin. PyPy is supported at runtime but not for type checking. Verify before relying: - Whether the mypy plugin remains compatible with mypy versions beyond 1.0 given the dormant maintenance status. - Whether the type stubs remain accurate for recent Trio releases (last release 2023-12-01). ## Package facts - License: MIT -or- Apache License 2.0 (permissive) - Python support: unspecified - Install friction: low - Maintenance: dormant - Downloads: 1.4M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags trio type stubs mypy, static typing async trio, trio type hints, mypy plugin trio, async generator typing, trio type checking, pep 561 stubs trio, type-stubs, mypy-plugin, async-typing [View on SkillFed](https://skillfed.io/packages/trio-typing) · [View on PyPI](https://pypi.org/project/trio-typing/)