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 click

Click supports Python 3.4 and newer, Python 2.7, and PyPy.

A Simple Example

What does it look like? Here is an example of a simple Click program:

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("Hello, %s!" % name)

if __name__ == '__main__':
    hello()

And what it looks like when run:

$ 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-7.0.tar.gz (286.2 kB view details)

Uploaded Source

Built Distribution

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

Click-7.0-py2.py3-none-any.whl (81.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file Click-7.0.tar.gz.

File metadata

  • Download URL: Click-7.0.tar.gz
  • Upload date:
  • Size: 286.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for Click-7.0.tar.gz
Algorithm Hash digest
SHA256 5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7
MD5 7f53d50f7b7373ebc7963f9ff697450a
BLAKE2b-256 f85cf60e9d8a1e77005f664b76ff8aeaee5bc05d0a91798afd7f53fc998dbc47

See more details on using hashes here.

File details

Details for the file Click-7.0-py2.py3-none-any.whl.

File metadata

  • Download URL: Click-7.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 81.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for Click-7.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13
MD5 4de489e31c57834a21b8be7111dab613
BLAKE2b-256 fa3745185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec

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