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

Uploaded Source

Built Distribution

click-8.0.0-py3-none-any.whl (96.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: click-8.0.0.tar.gz
  • Upload date:
  • Size: 326.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.1

File hashes

Hashes for click-8.0.0.tar.gz
Algorithm Hash digest
SHA256 7d8c289ee437bcb0316820ccee14aefcb056e58d31830ecab8e47eda6540e136
MD5 72f2aca7431d359e3bf4f20c5305a301
BLAKE2b-256 d599286fd2fdfb501620a9341319ba47444040c7b3094d3b6c797d7281469bf8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: click-8.0.0-py3-none-any.whl
  • Upload date:
  • Size: 96.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.1

File hashes

Hashes for click-8.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e90e62ced43dc8105fb9a26d62f0d9340b5c8db053a814e25d95c19873ae87db
MD5 8a76555e9c299ed5f92110a815e2bae6
BLAKE2b-256 8011597f9102867dc0972b698972f05f50925f586639e57beba4db352029e8f9

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