skillfed

trio-typing

Static type checking support for Trio and related projects

trio-typing v0.10.0 1.4M downloads/30d#3,946 on PyPI29
Permissive license MIT -or- Apache License 2.0 DORMANT released

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-typing

uv

uv add trio-typing

poetry

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 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

Development Status :: 3 - AlphaFramework :: TrioIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIX :: BSDOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

trio type stubs mypystatic typing async triotrio type hintsmypy plugin trioasync generator typingtrio type checkingpep 561 stubs trio
type-stubsmypy-pluginasync-typing

More Software Development packages