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.4.tar.gz (334.8 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.4-py3-none-any.whl (98.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: click-8.1.4.tar.gz
  • Upload date:
  • Size: 334.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for click-8.1.4.tar.gz
Algorithm Hash digest
SHA256 b97d0c74955da062a7d4ef92fadb583806a585b2ea81958a81bd72726cbb8e37
MD5 d19686712c4a599bc8bf1f6f3ea7947d
BLAKE2b-256 7788b0cc5fe95c31c301e9823ea9b028f669c0dcfa205ff71111037a5ed4892c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: click-8.1.4-py3-none-any.whl
  • Upload date:
  • Size: 98.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for click-8.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2739815aaa5d2c986a88f1e9230c55e17f0caad3d958a5e13ad0797c166db9e3
MD5 6cffa64b850cd54c9fc1b152272431f3
BLAKE2b-256 f9a6dc327484918f1656cc9fcebebe77efcfc0ef0d447fa925a8760ee55abe0e

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