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.2.tar.gz (329.3 kB view details)

Uploaded Source

Built Distribution

click-8.0.2-py3-none-any.whl (97.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: click-8.0.2.tar.gz
  • Upload date:
  • Size: 329.3 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.2.tar.gz
Algorithm Hash digest
SHA256 7027bc7bbafaab8b2c2816861d8eb372429ee3c02e193fc2f93d6c4ab9de49c5
MD5 f617e27a51a27d1f69aede198c5b27f6
BLAKE2b-256 d2be7a8b32b295aedc3e92494f9a4ac919d394bc04ac9822042953d6f54c2a50

See more details on using hashes here.

File details

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

File metadata

  • Download URL: click-8.0.2-py3-none-any.whl
  • Upload date:
  • Size: 97.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3fab8aeb8f15f5452ae7511ad448977b3417325bceddd53df87e0bb81f3a8cf8
MD5 bec8de2eb26400c8aad09a9bcb94a26a
BLAKE2b-256 a73b7efef23f3d4ea464ee9a518168d155cf007dc650a25898818c1712844999

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