# Click — card for AI agents

Python package for composing command-line interfaces with decorators.

Category: Dev workflow and config · PyPI package `click` · latest version 8.5.0 (checked 2026-11-01)
Install: `pip install click`
License: BSD-3-Clause (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Agent Skills for it
- click-test-plan from Owl-Listener/designer-skills: `npx skills add Owl-Listener/designer-skills --skill click-test-plan`

## Numbers (AgentGid data)
- Gid Score: 81.7 (#74 of all tools, 5 of 299 in its category)
- Used in 154 public projects set up for AI coding agents (2.5%)
- Downloads last week: 268,336,487 (as of 2026-11-24), +19.9% over 4 weeks
- GitHub stars: 17,845 (as of 2026-11-24)
- Last push: 2026-11-16

## Often used with
Pydantic 64.9%, python-dotenv 61.7%, PyYAML 60.4%, Requests 55.8%, Rich 55.2%, Uvicorn 49.4%

## Checked alternatives (same job)
- Typer: https://agentgid.com/tools/typer/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/click-py/
- Repository: https://github.com/pallets/click


## Click: build command-line tools in Python

Click is a free Python library for making command-line tools, the programs you run by typing a command in a terminal. You describe the options with a few lines above a function, and Click reads what the user typed, checks it and writes the help screen. It does not draw windows or web pages.

### Where to use it
- A script your team can run: Your assistant wrote a Python script that resizes photos or imports a price list; Click turns it into a command with named options, defaults and a --help screen.
- One tool with several commands: An admin helper for your shop with separate commands such as create-user and wipe-orders, each with its own options and help.
- Ask before deleting things: A cleanup command asks "Are you sure?" and hides a password while it is typed, so nobody wipes data or leaks a secret by accident.
- Keys from settings, not the command: A command reads a service's secret key from a setting on the server instead of the typed command, so the key does not end up in the shell history.
- Check your commands in tests: Your assistant writes tests that run each command with sample input and check the exit code and the printed text.
- Tab completion for your tool: People who use your tool every day press Tab to finish command and option names in their terminal.

### How to start
- Install Click into your project's virtual environment.

```
pip install click
```

- Write a command as a decorated function and call it.

```
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()
```

- To run it as a plain command (and get tab completion), add it to pyproject.toml as an entry point and install the project.

```
[project.scripts]
hello = "hello.hello:cli"
```


### License
Free to use in any product, paid or closed. If you ship Click's own files, keep its copyright notice and license text with them. You may not use the project's name to promote your product without permission.

### Good to know
- Version 8.5 needs Python 3.10 or newer; 8.2 dropped Python 3.7 to 3.9.
- Tab completion works only when the tool is installed as a command, not when started with python script.py.
- The look of the help screen can be changed only a little, on purpose; rich-click adds colors and panels on top.
- Its progress bar is simple; the docs point to tqdm for more.
- The test helper changes the whole running program while it works, so it is for tests only and not safe across threads.

Checked 2026-11-11 against: https://click.palletsprojects.com/en/stable/, https://click.palletsprojects.com/en/stable/why/, https://click.palletsprojects.com/en/stable/quickstart/, https://click.palletsprojects.com/en/stable/options/, https://click.palletsprojects.com/en/stable/option-decorators/, https://click.palletsprojects.com/en/stable/prompts/, https://click.palletsprojects.com/en/stable/commands-and-groups/, https://click.palletsprojects.com/en/stable/testing/, https://click.palletsprojects.com/en/stable/entry-points/, https://click.palletsprojects.com/en/stable/shell-completion/, https://click.palletsprojects.com/en/stable/utils/, https://click.palletsprojects.com/en/stable/changes/, https://click.palletsprojects.com/en/stable/license/, https://github.com/pallets/click/blob/main/README.md, https://pypi.org/pypi/click/json

### Mistakes to avoid
- Don't: CliRunner(mix_stderr=False), copied from tests written for Click 8.1 → Do: CliRunner() and read result.stdout, result.stderr or result.output (8.2.0 removed the mix_stderr parameter; in our run on 8.5.1 it raised TypeError (unexpected keyword argument).)
- Don't: click.__version__ to check the installed version → Do: importlib.metadata.version("click") (The attribute is deprecated since 8.2.0; in our run on 8.5.1 it printed a DeprecationWarning that names removal in Click 9.1.)
- Don't: Subclassing click.MultiCommand or click.BaseCommand from old examples → Do: Subclass click.Group or click.Command (Both old base classes are deprecated since 8.2.0.)
- Don't: Telling users to run def create_user as "tool create_user" → Do: Call it "tool create-user", or name the command explicitly with @cli.command("create_user") (Click replaces underscores with dashes in command names; our run listed create-user and wipe-orders.)
- Don't: with runner.isolated_filesystem() in new tests → Do: Use pytest's tmp_path (or tempfile.TemporaryDirectory) and absolute paths (isolated_filesystem() is deprecated since 8.5.0 because it changes the working folder of the whole process.)

### Questions
- Can I use it in a paid, closed-source tool? Yes. Click is under the BSD-3-Clause license; keep its copyright notice if you ship its files.
- Why not Python's built-in argparse? Click's docs say argparse does not allow proper nesting of commands, so Click has its own parser.
- Can it ask for a password without showing it? Yes. password_option() asks twice and hides what is typed.
- Which shells get tab completion? Bash 4.4 and newer, Zsh, Fish and, since 8.5.0, PowerShell.
- Is it still maintained? Yes. Version 8.5.1 was released on 2026-11-06 by the Pallets organization, which also makes Flask.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
