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

Uploaded Source

Built Distribution

click-8.1.6-py3-none-any.whl (97.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: click-8.1.6.tar.gz
  • Upload date:
  • Size: 336.1 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.6.tar.gz
Algorithm Hash digest
SHA256 48ee849951919527a045bfe3bf7baa8a959c423134e1a5b98c05c20ba75a1cbd
MD5 0ad74cc10856930a76b0560ccc55c162
BLAKE2b-256 72bdfedc277e7351917b6c4e0ac751853a97af261278a4c7808babafa8ef2120

See more details on using hashes here.

File details

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

File metadata

  • Download URL: click-8.1.6-py3-none-any.whl
  • Upload date:
  • Size: 97.9 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 fa244bb30b3b5ee2cae3da8f55c9e5e0c0e86093306301fb418eb9dc40fbded5
MD5 043416d14751ae24c8e8b0968b6fff78
BLAKE2b-256 1a70e63223f8116931d365993d4a6b7ef653a4d920b41d03de7c59499962821f

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