pallets/click


Python composable command line interface toolkit

https://palletsprojects.com/p/click/

License: BSD-3-Clause

Language: Python

Keywords: cli, click, python


$ 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 _ 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!

Donate

The Pallets organization develops and supports Click and other popular packages. In order to grow the community of contributors and users, and allow the maintainers to devote more time to the projects, please donate today.

Links

Project Statistics

Sourcerank 18
Repository Size 1.81 MB
Stars 8,175
Forks 809
Watchers 184
Open issues 222
Dependencies 16
Contributors 158
Tags 33
Created
Last updated
Last pushed

Top Contributors See all

Armin Ronacher Markus Unterwaditzer David Lord Nicholas Wiles Dan Sully Julen Ruiz Aizpuru Kevin Yap Stephen Rosen Zachery Bir jcrotts Steven Pequeno JosiahDub Jon Dufresne Brett Bethke Ryan Siemens Claudio Bandera Simon Jagoe José Carlos García con-f-use Sławomir Ehlert

Packages Referencing this Repo

click
Click is a Python package for creating beautiful command line interfaces in a composable way with...
Latest release 7.0 - Published - 8.18K stars
click
Composable command line interface toolkit
Latest release 7.0 - Updated - 8.18K stars

Recent Tags See all

7.0 September 25, 2018
6.7 January 06, 2017
6.6 April 04, 2016
6.5 April 04, 2016
6.4 March 23, 2016
6.3 February 22, 2016
6.2 November 27, 2015
6.1 November 27, 2015
6.0 November 24, 2015
5.1 August 17, 2015
5.0 August 16, 2015
4.1 July 14, 2015
4.0 March 31, 2015
3.3 September 07, 2014
3.2 August 22, 2014

Interesting Forks See all

makerdao/click
Python composable command line utility
Python - BSD-3-Clause - Updated - 2 stars
hackebrot/click
Python composable command line utility
Python - BSD-3-Clause - Last pushed - 1 stars
ionelmc/click
Python composable command line utility
Python - Other - Last pushed - 1 stars
Ublimjo/click
Python composable command line utility
Python - Other - Last pushed - 1 stars
pgkelley4/click
Python composable command line utility
Python - BSD-3-Clause - Last pushed - 1 stars

Something wrong with this page? Make a suggestion

Last synced: 2017-05-21 10:28:51 UTC

Login to resync this repository