click README

The project's README from github.com/pallets/click. As one markdown file: README.md.

Click

Click is a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary. It's the "Command Line Interface Creation Kit". It's highly configurable but comes with sensible defaults out of the box.

It aims to make the process of writing command line tools quick and fun while also preventing any frustration caused by the inability to implement an intended CLI API.

Click in three points:

A Simple Example

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()
$ python hello.py --count=3
Your name: Click
Hello, Click!
Hello, Click!
Hello, Click!

Donate

The Pallets organization develops and supports Click and other popular packages. In order to grow the community of contributors and users, and allow the maintainers to devote more time to the projects, please donate today.

Contributing

See our detailed contributing documentation for many ways to contribute, including reporting issues, requesting features, asking or answering questions, and making PRs.

click (pallets/click)

Searching Database…

17.8K ·GitHub
What is this?Click is a Python package for building beautiful command line interfaces in a composable way, with as little code as necessary. Its name stands for 'Command Line Interface Creation Kit'.
Is it a tool I run from the terminal, or a library I code against?It is a library, not an app: you import it into your Python project and write code with it to create your own command line programs.
How do I add it to my project?Install it with pip ('pip install click'), then import it in your Python code and start defining commands; the toolkit assembles the CLI around them.
Do I need anything besides a Python interpreter?No. It is a regular pip package with no required services or system dependencies, so any machine that runs Python can use it.
Do I need to be a Python developer to use it?Yes, it is for developers building CLIs, from single-command utilities to large multi-command programs; people who run the finished tools never see Click itself.
Will it work on Windows and macOS, or only Linux?Anywhere Python runs. The project lists Windows, macOS and Linux, and as a pure Python pip package it is cross-platform.
What do I get out of the box when building with Click?Help pages for your commands are generated automatically, and while the toolkit is highly configurable it ships with sensible defaults, so you write very little code for a polished CLI.
My tool will have many subcommands — can Click handle that?Yes. It supports arbitrary nesting of commands and can lazy-load subcommands at runtime, so a large CLI stays organized and starts fast.
Is this a fresh experiment or an established project?Established: development started in 2014 and it has about 17.8k stars on GitHub. The Pallets organization develops and supports it alongside other popular packages and accepts donations to fund maintenance.
Why pick Click over writing the argument parsing by hand?That is the problem it was created for: its stated aim is to make writing command line tools quick and fun and to prevent the frustration of failing to implement the CLI API you intended.
Creator
pallets
Size
5 MB
Stars
17.8K
Age
12y
Commits · 90 Days