trio-typing
Static type checking support for Trio and related projects
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 on this page — 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
trio-typing on PyPI
pip
pip install trio-typinguv
uv add trio-typingpoetry
poetry add trio-typingInstalling 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 | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — trio, typing-extensions, mypy-extensions, async-generator, packaging, importlib-metadata |
| Maintenance | dormant — 987 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,402,157/month — #3,946 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: trio_typing-0.10.0-py3-none-any.whl
Keywords: async, trio, mypy
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
types-WerkzeugProvides PEP 561 type stubs for Werkzeug,…
permissive · top 5,000 on PyPI
types-FlaskProvides PEP 561 type stubs for Flask to enable…
permissive · top 5,000 on PyPI
outcomeCaptures the outcome of Python function…
permissive · top 1,000 on PyPI
types-SQLAlchemyProvides PEP 561 type stubs for SQLAlchemy,…
permissive · top 15,000 on PyPI
types-backportsProvides PEP 561 type stubs for the backports…
permissive · top 15,000 on PyPI
types-clickProvides PEP 561 type stubs for the click…
permissive · top 5,000 on PyPI
types-atomicwritesProvides type stubs for the atomicwrites…
permissive · top 15,000 on PyPI
types-dataclassesProvides type stubs for Python's dataclasses…
permissive · top 15,000 on PyPI
types-cryptographyProvides PEP 561 type stubs for the…
permissive · top 5,000 on PyPI
types-futuresProvides type stubs for the futures package,…
permissive · top 15,000 on PyPI