Pythonclickv8.3.1
PythonBeginner-friendly

click

Composable command line interface toolkit

clicommand-lineargparsepythonterminalclickpallets
The Problem

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.

Mental Model

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.

60-second start

Install click

pip install click
import click

Use 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).

Alternatives
typerBuilt on Click; derives CLI arguments from type annotations โ€” less boilerplate if you already use type hints
argparseStandard library, no dependencies โ€” good for simple scripts you don't want to install
fireGoogle's library that auto-generates CLIs from any Python object; good for quick scripting

Ready to explore the full API?

See every class, function, and relationship in an interactive graph.