The hflow CLI has roughly 750 lines of argparse setup in src/hflow/cli.py:119, Namespace-based handlers, and manual dispatch in main:1697. Migrate it to Typer so command parameters have explicit types and command registration owns dispatch.
Scope: the installed hflow command and python -m hflow.cli. Keep library operations in their existing modules. Add Typer as a direct root dependency and update uv.lock.
Acceptance criteria:
- Replace argparse setup and Namespace-based command handlers with typed Typer commands, including nested command groups.
- Preserve existing command names, positional arguments, option aliases, defaults, repeated options, boolean flag meanings, and mutually exclusive options. Local paths and object-store URLs must keep their current semantics.
- Preserve configuration and environment precedence, stdout/stderr separation, and success/failure exit codes. Keep
main(argv) -> int for existing callers, including its help and parse-error SystemExit behavior.
- Keep optional runtime/server imports deferred. Help wording and layout may change, but commands and options remain discoverable through
--help, and --version still works.
- Adapt existing CLI tests to exercise the command boundary. Extend coverage only for uncovered HFlow outcomes or compatibility boundaries; parser implementation assertions can be replaced. Start with
tests/test_cli.py, tests/test_runtime_cli.py, and other tests importing hflow.cli.
- Keep data formats and pipeline behavior unchanged. Limit this PR to the main CLI; example migrations are separate.
Validation, following CONTRIBUTING.md:
uv sync --locked
uv run ruff check --fix
uv run ruff format
uv run ty check
uv run pytest -q
uv run hflow --help
uv run python -m hflow.cli --help
The
hflowCLI has roughly 750 lines of argparse setup in src/hflow/cli.py:119, Namespace-based handlers, and manual dispatch in main:1697. Migrate it to Typer so command parameters have explicit types and command registration owns dispatch.Scope: the installed
hflowcommand andpython -m hflow.cli. Keep library operations in their existing modules. Add Typer as a direct root dependency and updateuv.lock.Acceptance criteria:
main(argv) -> intfor existing callers, including its help and parse-error SystemExit behavior.--help, and--versionstill works.tests/test_cli.py,tests/test_runtime_cli.py, and other tests importinghflow.cli.Validation, following CONTRIBUTING.md: