typed-argparse
💡 write type-safe and elegant CLIs with a clear separation of concerns.
Features
- Argument parsing based on type annotation (including runtime validation).
- Support for many common types.
- Clear separation of concern between argument parsing and business logic.
- Support for super-low-latency shell auto-completions.
- Great for writing sub-command CLIs.
- Very lightweight.
- No dependencies.
- Fully typed itself, no extra type stubs required.
- Offers both a high-level and a low-level API.
The high-level API generally requires less code to write, is fully based on type annotations, and is the preferred way for writing new CLIs.
The low-level API is mainly a low-effort migration path for incorporating type-safety into existing CLIs based on
argparse
.
Install
The only requirement is a modern Python (3.8+).
Next step
Continue with getting started.