Click is a Python command line interface creation kit from the Pallets organization, composing beautiful CLIs with minimal code through decorators, with arbitrary command nesting, automatic help pages, and lazy subcommand loading.
- 8.5.0
- Published at
- Aug 27, 2026
- 17,794
- Stars
- 1,290
- Download
- Synced at
- 8d ago
Latest release
8.5.0Aug 27, 2026, 04:00 AMDownloads slow? Switch the source anytime above
README
Project Overview
Click is a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary. It stands for Command Line Interface Creation Kit, is highly configurable yet comes with sensible defaults, and aims to make writing command line tools quick and fun.
| Item | Value |
|---|---|
| Platform | Python |
| Language | Python |
| License | BSD-3-Clause |
| Maintainer | The Pallets organization |
Write CLIs with decorators: arbitrary command nesting, automatic help pages, and lazy subcommand loading.
Key Features
- Composable commands: commands nest to any depth, keeping complex CLIs well organized
- Automatic help pages: help text is generated from function docs and parameter definitions
- Lazy subcommands: subcommands can be loaded on demand at runtime for faster startup
- Decorator based:
@click.commandand@click.optionturn plain functions into commands - Interactive prompts: options support prompts, asking the user when a value is missing
- Sensible defaults: good behavior out of the box while remaining highly configurable
Target Audience
- Python CLI tool developers
- Operations automation script authors
- Builders of multi-command tools
- Developers wrapping scripts as commands
Quick Start
- Install:
pip install click- Define a command with decorators:
import click
@click.command()
@click.option('--count', default=1, help='Number of greetings.')
@click.option('--name', prompt='Your name', help='The person to greet.')
def hello(count, name):
'''Simple program that greets NAME for a total of COUNT times.'''
for _ in range(count):
click.echo(f'Hello, {name}!')
if __name__ == '__main__':
hello()- Run it:
python hello.py --count=3Core Advantages
- Less code: declarative decorators produce a complete CLI in a few lines
- Predictable behavior: help pages and argument handling are generated, so users get started quickly
- Flexible composition: commands nest freely, letting small scripts grow into large tools
System Requirements
| Item | Requirement |
|---|---|
| Runtime | Python (pip install) |
| License | BSD-3-Clause |
Notes
- Docstring is the docs: a command's docstring becomes its help page description, so write it clearly
- Interactive prompt: the example sets a prompt for
--name, so the program pauses for input when the option is missing
Release history
Sort