Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Comparison of argparse, Click and Typer¶
I personally prefer argparse. For simpler examples, typer (which vendors click) is elegant. However, when you need customization and flexibility, it becomes a mess.
Aspect | |||
|---|---|---|---|
Standard library | Yes, built into Python | No, third-party ( | No, third-party ( |
API style | Imperative: build a | Decorator-based: | Decorator-based with type hints: plain function signatures with Python type annotations |
Type inference | No, types specified explicitly via | Partial, types specified explicitly via | Yes, types and defaults inferred automatically from function signatures |
Boilerplate for simple CLIs | High | Medium | Low |
Subcommands | Supported via | Supported via | Supported by composing multiple functions/ |
Automatic help generation | Yes, basic | Yes, richer formatting | Yes, richer formatting (colorized output via Rich if installed) |
Shell completion | No built-in support | Yes, built-in support for Bash/Zsh/Fish | Yes, built-in support for Bash/Zsh/Fish/PowerShell |
Testing utilities | No built-in support | Yes, | Yes, |
Ecosystem/plugins | None | Large, many extensions (e.g. | Growing, inherits Click’s ecosystem |
Learning curve | Low, familiar to most Python developers | Medium | Low, especially for developers already using type hints |
Best fit | Small scripts, avoiding extra dependencies | Complex CLIs needing fine-grained control and a mature plugin ecosystem | Modern CLIs prioritizing developer ergonomics and type-hint-driven design |