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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for click-8.1.3.tar.gz
Algorithm Hash digest
SHA256 7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e
MD5 a804b085de7a3ff96968e38e0f6f2e05
BLAKE2b-256 598784326af34517fca8c58418d148f2403df25303e02736832403587318e9e8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: click-8.1.3-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.4

File hashes

Hashes for click-8.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48
MD5 7a8260e7bdac219be27f0bdda48e79ce
BLAKE2b-256 c2f1df59e28c642d583f7dacffb1e0965d0e00b218e0186d7858ac5233dce840

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