Component
Need
The infrahubctl CLI is built on Typer, which has
no native support for async command handlers. To work around this we maintain our own
AsyncTyper subclass (infrahub_sdk/async_typer.py) that wraps every async command in
asyncio.run. This is a local shim we have to keep working across Typer releases, and
Typer itself has seen limited maintenance activity.
The ask is to migrate the CLI to Cyclopts so
that:
- The locally-maintained
AsyncTyper shim can be removed — Cyclopts supports async
command handlers natively.
- The project depends on a more actively maintained CLI framework for better long-term
support.
- Startup can benefit from Cyclopts' lazy import of subcommands, reducing CLI overhead.
Context
- The local shim lives in
infrahub_sdk/async_typer.py (AsyncTyper(Typer)).
- Typer /
AsyncTyper is used broadly across the CLI — roughly two dozen modules under
infrahub_sdk/ctl/ import typer or AsyncTyper (commands, parameters, parsers,
and the object/ subcommands), so this is a wide surface, not a single entry point.
typer>=0.15.0 is currently pinned in pyproject.toml (declared in two dependency
groups).
- Ruff carve-outs exist specifically for Typer patterns (
B008 for typer.Option in
defaults, DOC501 for typer.Exit/Abort as control flow) — these will need
revisiting as part of the migration.
References
Component
Need
The
infrahubctlCLI is built on Typer, which hasno native support for async command handlers. To work around this we maintain our own
AsyncTypersubclass (infrahub_sdk/async_typer.py) that wraps every async command inasyncio.run. This is a local shim we have to keep working across Typer releases, andTyper itself has seen limited maintenance activity.
The ask is to migrate the CLI to Cyclopts so
that:
AsyncTypershim can be removed — Cyclopts supports asynccommand handlers natively.
support.
Context
infrahub_sdk/async_typer.py(AsyncTyper(Typer)).AsyncTyperis used broadly across the CLI — roughly two dozen modules underinfrahub_sdk/ctl/importtyperorAsyncTyper(commands, parameters, parsers,and the
object/subcommands), so this is a wide surface, not a single entry point.typer>=0.15.0is currently pinned inpyproject.toml(declared in two dependencygroups).
B008fortyper.Optionindefaults,
DOC501fortyper.Exit/Abortas control flow) — these will needrevisiting as part of the migration.
References