click
Composable command line interface toolkit
Python's argparse requires registering each argument imperatively, writing help text separately, and handling subcommands through awkward nesting. For anything beyond a trivial script, you're fighting the framework. Click's insight was that CLI structure should mirror code structure.
Click uses decorators to turn ordinary Python functions into CLI commands. Add @click.command() and @click.option() to a function, and it instantly becomes a command with argument parsing, --help generation, type validation, and shell completion โ all derived from the decorator chain.
Install click
pip install click
import clickUse it when
Use Click for any CLI tool you're distributing or that has more than 2-3 arguments. It's the standard choice for Python CLIs, especially when you need subcommands (like git-style interfaces), prompts, progress bars, or colored output.
Skip it when
For extremely simple one-argument scripts, argparse or even sys.argv is fine. If you want type hints to drive the CLI automatically, look at Typer (which wraps Click under the hood).
Ready to explore the full API?
See every class, function, and relationship in an interactive graph.