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_hotoffthehamster-7.8.0.tar.gz (101.8 kB view details)

Uploaded Source

Built Distribution

click_hotoffthehamster-7.8.0-py3-none-any.whl (100.9 kB view details)

Uploaded Python 3

File details

Details for the file click_hotoffthehamster-7.8.0.tar.gz.

File metadata

  • Download URL: click_hotoffthehamster-7.8.0.tar.gz
  • Upload date:
  • Size: 101.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for click_hotoffthehamster-7.8.0.tar.gz
Algorithm Hash digest
SHA256 d38f60768b49f31fe3188d80420249e18cd3f1c9e0fb0ba10d43e62e15349ae3
MD5 606ef1a9ee0118e5b62db6c29f9d2825
BLAKE2b-256 516c8fb764e0e8fd728390c19e78c41f161ff48610ece53469236e1ef7cc57a5

See more details on using hashes here.

File details

Details for the file click_hotoffthehamster-7.8.0-py3-none-any.whl.

File metadata

File hashes

Hashes for click_hotoffthehamster-7.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5050ff1cd06ce3fe3c3553e47fa9ca50438196b1e63648e1d859450dee091206
MD5 0e6c6a0d12fbb19593ca19b2380e214c
BLAKE2b-256 67c5ac0bedc457e47221482d5929d48c3ab80508a06f640148164f0cd730c47b

See more details on using hashes here.

Supported by

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