You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
David Lord 08f71b08e2
Merge pull request #2329 from pallets/dependabot/github_actions/actions/cache-3.0.5
1 week ago
.github Bump actions/cache from 3.0.4 to 3.0.5 1 week ago
artwork Initial commit 8 years ago
docs Update quickstart.rst 4 months ago
examples Merge remote-tracking branch 'origin/8.0.x' 1 year ago
requirements update requirements 3 months ago
src/click Merge branch '8.1.x' 3 months ago
tests disallow use of is_flag and multiple in option 4 months ago
.editorconfig add EditorConfig 2 years ago
.gitignore delete directory .DS_Store (#1938) 1 year ago
.pre-commit-config.yaml update requirements 3 months ago
.readthedocs.yaml pin os and python version in rtd build 8 months ago
CHANGES.rst Merge branch '8.1.x' 3 months ago
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 3 years ago
CONTRIBUTING.rst Improve the contributing guide 1 year ago
LICENSE.rst standardize license 3 years ago
MANIFEST.in add typing annotations 1 year ago
README.rst update pip link 1 year ago
setup.cfg Merge branch '8.0.x' 7 months ago
setup.py install importlib_metadata on Python < 3.8 1 year ago
tox.ini update tool config 7 months ago

README.rst

$ 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:

  • Arbitrary nesting of commands
  • Automatic help page generation
  • Supports lazy loading of subcommands at runtime

Installing

Install and update using pip:

$ pip install -U click

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.