Repolode
pallets

pallets/click

A Python toolkit for building composable command line interfaces with nested commands, automatic help pages, and lazy-loaded subcommands.

Stars
17,817
Forks
3,296
Open issues
89
Last commit
14 hours ago

What is it?

Click is a Python package for writing command line tools. Developers declare commands, options and arguments with decorators, and Click handles parsing, validation, prompting and help text. Commands can be nested arbitrarily, and subcommands can be loaded lazily at runtime.

The library is configurable but ships with defaults that work out of the box. A basic program needs only a decorated function and a call to the command object, and option handling includes features such as default values, interactive prompts and generated help output.

Click is developed under the Pallets organization and released under the BSD-3-Clause license. It is aimed at Python developers who want to build CLIs without hand-writing argument parsing.

Key features

  • 01Decorator-based definition of commands, options and arguments
  • 02Arbitrary nesting of commands and subcommands
  • 03Automatic help page generation
  • 04Lazy loading of subcommands at runtime
  • 05Interactive prompts for missing option values

Use cases

  • Building a Python command line tool with multiple subcommands
  • Creating scripts that prompt users for input when arguments are missing
  • Replacing hand-written argparse code with a more concise decorator style

Quick start

  1. 1

    Install Click with pip

    pip install click
  2. 2

    Save the example as hello.py and run it

    python hello.py --count=3

In collections

Topics

FAQ

What is click?
A Python toolkit for building composable command line interfaces with nested commands, automatic help pages, and lazy-loaded subcommands. Click is a Python package for writing command line tools. Developers declare commands, options and arguments with decorators, and Click handles parsing, validation, prompting and help text. Commands can be nested arbitrarily, and subcommands can be loaded lazily at runtime.
Is click free to use? What license does it have?
click is open source under the BSD-3-Clause license. Check the license terms before using it in commercial products.
Is click still maintained?
Actively maintained. The last commit to click was on Nov 6, 2026.
What can I use click for?
Building a Python command line tool with multiple subcommands Creating scripts that prompt users for input when arguments are missing Replacing hand-written argparse code with a more concise decorator style
How do I install click?
Install Click with pip: pip install click Save the example as hello.py and run it: python hello.py --count=3
Where can I get click?
The source code and installation instructions are on GitHub: https://github.com/pallets/click

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects