Typer with first-class async support: unified sync/async commands, callbacks, and lifecycle event handlers.
Maintained. Last release 3 months ago, commits in 4 of the last 26 weeks. Weaker on commit activity.
pip install async-typerasync-typer
Typer with first-class async support:
async def commands and callbacks work alongside regular sync ones via the
same @app.command() decorator — no second API to remember — plus lifecycle
event handlers for setting up and tearing down async resources.
Features
- One decorator, sync or async —
@app.command()and@app.callback()accept both regular andasync deffunctions. The wrapper is transparent; Typer's--help, option parsing, and type conversion all work as normal. - Shared event loop across the command lifecycle — startup handlers,
the command body, and shutdown handlers all run on the same
asyncio.Runner, so async resources created on startup (connection pools, HTTP sessions, etc.) remain usable by the command and by shutdown. - Fully typed — ships with a
py.typedmarker and strict type hints. - Drop-in replacement — re-exports Typer's public API, so
from async_typer import Option, Argument, echo, ...works without a second import line. A test asserts the re-export list matches the targeted typer release exactly, so it cannot silently drift.
Installation
pip install async-typer
# or
uv add async-typer
Requires Python 3.11+.
Versioning
async-typer's version is the typer version it targets. async-typer 0.27.2
is built and tested against typer 0.27.2, and its dependency range is pinned
to that minor series (typer>=0.27.2,<0.28.0). To find the right release, look
up the typer version you are on:
| typer | async-typer |
|---|---|
| 0.27.x | 0.27.x |
When async-typer needs a release of its own without a matching typer release, a
fourth segment is appended — 0.27.2.1, 0.27.2.2 — which still targets
typer 0.27.2 and sorts between 0.27.2 and 0.27.3.
Releases before 0.27.2 (0.1.x, 0.2.x) predate this policy and carry a
wide typer>=0.9.0,<1.0.0 range instead.