typer
Typer, build great CLIs. Easy to code. Based on Python type hints
Click is powerful but verbose โ every option needs both a decorator and a parameter. If you're already using Python type hints, you're duplicating information: once in the function signature and once in the Click decorators. Typer, built by the FastAPI author, makes type hints the single source of truth for CLI interfaces.
Typer reads your function's type annotations to build the CLI automatically. def main(name: str, count: int = 1) becomes a command with a required --name string argument and an optional --count integer with a default. The same annotations that your IDE uses for autocomplete become the CLI's argument definitions.
Install typer
pip install typer
import typerUse it when
Use Typer when you're already writing typed Python code and want to expose it as a CLI with minimal boilerplate. It's especially good for tools used internally or distributed as packages where IDE support matters.
Skip it when
Typer's magic can be surprising โ if you need precise control over how arguments are parsed, displayed, or composed, drop down to Click directly. For simple one-file scripts, Click or even argparse may be clearer.
Ready to explore the full API?
See every class, function, and relationship in an interactive graph.