Skip to main content

A simple wrapper around optparse for powerful command line utilities.

Project description

What’s Click?

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 x 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: John
Hello John!
Hello John!
Hello John!

Donate

The Pallets organization develops and supports Flask and the libraries it uses. In order to grow the community of contributors and users, and allow the maintainers to devote more time to the projects, please donate today.

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.0.0a1.tar.gz (289.7 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.0.0a1-py2.py3-none-any.whl (78.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file click--hotoffthehamster-7.0.0a1.tar.gz.

File metadata

File hashes

Hashes for click--hotoffthehamster-7.0.0a1.tar.gz
Algorithm Hash digest
SHA256 248b118980dc23d6610a88e39c6a6fd4c536d8a8eb04a2fd938b9244c3561f0f
MD5 449218b7f842f762451fc86520470238
BLAKE2b-256 9930c5e1fc5b747644da4e5ab2e35ffac40f3f07b795e976a63a02e4ddf0330d

See more details on using hashes here.

File details

Details for the file click_hotoffthehamster-7.0.0a1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for click_hotoffthehamster-7.0.0a1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 88cdf69a5aa50986c551ad182434ec3c98b17e249e4180b2cfeb8d6ae6388749
MD5 1467eca2a9c32963af1d3a38a4c27df2
BLAKE2b-256 d04152f95ee2af9cf873bf9f92c116e633b2abec072a8fc9ff07443ffa4c6790

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