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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

click-8.1.2-py3-none-any.whl (96.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: click-8.1.2.tar.gz
  • Upload date:
  • Size: 330.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for click-8.1.2.tar.gz
Algorithm Hash digest
SHA256 479707fe14d9ec9a0757618b7a100a0ae4c4e236fac5b7f80ca68028141a1a72
MD5 04dea7b270d2e3c5f137758ad64930c2
BLAKE2b-256 42e14cb2d3a2416bcd871ac93f12b5616f7755a6800bccae05e5a99d3673eb69

See more details on using hashes here.

File details

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

File metadata

  • Download URL: click-8.1.2-py3-none-any.whl
  • Upload date:
  • Size: 96.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for click-8.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 24e1a4a9ec5bf6299411369b208c1df2188d9eb8d916302fe6bf03faed227f1e
MD5 e968825174e7981370fe80227292cdc0
BLAKE2b-256 a066c8196ad693d62384d8e800e5bd27434a64c0057fe169b61c69a73f1614a8

See more details on using hashes here.

Supported by

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