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

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for click_hotoffthehamster-7.8.1.tar.gz
Algorithm Hash digest
SHA256 10d334a6663a439b7c8cd5d4139c1521c687e1a6125dbd555290e7cb80b6a047
MD5 157dbcec02ae12ac6e53a24e0b342385
BLAKE2b-256 8337c0ae223b38d2e90d78682c034015421eabcc2aa7068fac8b287dc05fce5e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for click_hotoffthehamster-7.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 06c1eecb8b8054be878650e953d3fe13167a6c4e17d9c1b48bd1ff44ac88cdd8
MD5 14c62778367d90ab8e79d7e56fa144d9
BLAKE2b-256 df9322f44dd02e2abffc8e198bf3b80dd64feaa7ad6d0f6afe7f61ecd917c85b

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