Use these recipes when you already have a CLI command and want to move it to Milo's typed function contract. Each page shows a small before/after and the specific concepts to translate.
From argparse
Replace parser-first argparse code with typed Milo command handlers.
From Click
Translate Click command decorators, options, groups, and context into Milo.
From Typer
Move from type-hint CLI ergonomics to Milo's CLI/MCP/llms.txt contract.
From Python Fire
Narrow automatic Python object exposure into explicit Milo command contracts.
From Cobra
Map Cobra command trees, flags, and generated app structure into Milo groups.
Migration Rule
Move behavior first, then output polish:
- Convert one command handler into a typed Python function.
- Register it with
@cli.command. - Add docstring
Args:entries orAnnotated[..., Description(...)]. - Run
uv run milo verify app.py. - Add the four command contract tests before migrating the next command.
Keep old CLI compatibility wrappers only where users depend on exact argv shape. Milo's main contract is the function signature; schema, MCP, and llms.txt are derived from that signature.
Recipes
Official References Checked
In This Section
From argparse
Replace parser-first argparse code with typed Milo command handlers.
From Click
Translate Click command decorators, options, groups, and context into Milo.
From Cobra
Map Cobra command trees, flags, and generated app structure into Milo groups.
From Python Fire
Narrow automatic Python object exposure into explicit Milo command contracts.
From Typer
Move from type-hint CLI ergonomics to Milo's CLI/MCP/llms.txt contract.