index.md
This file
Path
docs/index.md
153 lines · 2.5 KiB · Markdown
Last changed by
Merge `stable` into `main` after `CHANGES` rST to Markdown conversion (#3563)Kevin Deldyckebefore adoption8a1b1a3
History of this fileTake it
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154{.hide-header}# Welcome to Click
```{image} _static/click-name.svg:align: center:height: 200px```
Click is a Python package for creating beautiful command line interfacesin a composable way with as little code as necessary. It's the "CommandLine Interface Creation Kit". It's highly configurable but comes withsensible defaults out of the box.
It aims to make the process of writing command line tools quick and funwhile also preventing any frustration caused by the inability to implementan intended CLI API.
Click in three points:
- arbitrary nesting of commands- automatic help page generation- supports lazy loading of subcommands at runtime
What does it look like? Here is an example of a simple Click program:
```{eval-rst}.. click: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 x in range(count): click.echo(f"Hello {name}!")
if __name__ == '__main__': hello()
And what it looks like when run:
.. click:run::
invoke(hello, ['--count=3'], prog_name='python hello.py', input='John\n')
It automatically generates nicely formatted help pages:
.. click:run::
invoke(hello, ['--help'], prog_name='python hello.py')```
You can get the library directly from PyPI:
```pip install click```
# Documentation
```{toctree}:maxdepth: 2
faqs```
## Tutorials
```{toctree}:maxdepth: 1
quickstartvirtualenv```
## How to Guides
```{toctree}:maxdepth: 1
entry-pointssetuptoolsstandalone-appsupgrade-guidessupport-multiple-versions```
## Conceptual Guides
```{toctree}:maxdepth: 1
design-opinionswhyclick-concepts```
## General Reference
```{toctree}:maxdepth: 1
parametersparameter-typesoptionsoption-decoratorsargumentscommands-and-groupscommandsdocumentationpromptshandling-filesadvancedcomplexextending-clicktestingutilsshell-completionexceptionscommand-line-referenceunicode-supportwincmd```
## API Reference
```{toctree}:maxdepth: 2
api```
# About Project
- This documentation is structured according to [Diataxis](https://diataxis.fr/) and written with [MyST](https://myst-parser.readthedocs.io/en/latest/)- [Version Policy](https://palletsprojects.com/versions)- [Donate](https://palletsprojects.com/donate)
```{toctree}:maxdepth: 1
contributingcontriblicensechanges```