Skip to main content

Composable command line interface toolkit

Project description

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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

click-8.0.3.tar.gz (329.0 kB view details)

Uploaded Source

Built Distribution

click-8.0.3-py3-none-any.whl (97.5 kB view details)

Uploaded Python 3

File details

Details for the file click-8.0.3.tar.gz.

File metadata

  • Download URL: click-8.0.3.tar.gz
  • Upload date:
  • Size: 329.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for click-8.0.3.tar.gz
Algorithm Hash digest
SHA256 410e932b050f5eed773c4cda94de75971c89cdb3155a72a0831139a79e5ecb5b
MD5 6bcf62c52c6b58c9977c7d19b0d0cbf9
BLAKE2b-256 f409ad003f1e3428017d1c3da4ccc9547591703ffea548626f47ec74509c5824

See more details on using hashes here.

File details

Details for the file click-8.0.3-py3-none-any.whl.

File metadata

  • Download URL: click-8.0.3-py3-none-any.whl
  • Upload date:
  • Size: 97.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for click-8.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 353f466495adaeb40b6b5f592f9f91cb22372351c84caeb068132442a4518ef3
MD5 f4399393e58c56b25d9b9e8a665d2255
BLAKE2b-256 4858c8aa6a8e62cc75f39fee1092c45d6b6ba684122697d7ce7d53f64f98a129

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page