Skip to content
Myr

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 file

Take it

Merge `stable` into `main` after `CHANGES` rST to Markdown conversion (#3563)Kevin Deldyckebefore adoption8a1b1a3

lines 1–2why, one step back
1{.hide-header}
2# Welcome to Click

Merge branch 'stable'David Lordbefore adoptiona9a218c

lines 3–153why, one step back
3
4```{image} _static/click-name.svg5:align: center6:height: 200px7```89Click is a Python package for creating beautiful command line interfaces10in a composable way with as little code as necessary. It's the "Command11Line Interface Creation Kit". It's highly configurable but comes with12sensible defaults out of the box.1314It aims to make the process of writing command line tools quick and fun15while also preventing any frustration caused by the inability to implement16an intended CLI API.1718Click in three points:1920- arbitrary nesting of commands21- automatic help page generation22- supports lazy loading of subcommands at runtime2324What does it look like? Here is an example of a simple Click program:2526```{eval-rst}27.. click:example::2829 import click3031 @click.command()32 @click.option('--count', default=1, help='Number of greetings.')33 @click.option('--name', prompt='Your name',34 help='The person to greet.')35 def hello(count, name):36 """Simple program that greets NAME for a total of COUNT times."""37 for x in range(count):38 click.echo(f"Hello {name}!")3940 if __name__ == '__main__':41 hello()424344And what it looks like when run:454647.. click:run::4849 invoke(hello, ['--count=3'], prog_name='python hello.py', input='John\n')505152It automatically generates nicely formatted help pages:535455.. click:run::5657 invoke(hello, ['--help'], prog_name='python hello.py')58```5960You can get the library directly from PyPI:6162```63pip install click64```6566# Documentation6768```{toctree}69:maxdepth: 27071faqs72```7374## Tutorials7576```{toctree}77:maxdepth: 17879quickstart80virtualenv81```8283## How to Guides8485```{toctree}86:maxdepth: 18788entry-points89setuptools90standalone-apps91upgrade-guides92support-multiple-versions93```9495## Conceptual Guides9697```{toctree}98:maxdepth: 199100design-opinions101why102click-concepts103```104105## General Reference106107```{toctree}108:maxdepth: 1109110parameters111parameter-types112options113option-decorators114arguments115commands-and-groups116commands117documentation118prompts119handling-files120advanced121complex122extending-click123testing124utils125shell-completion126exceptions127command-line-reference128unicode-support129wincmd130```131132## API Reference133134```{toctree}135:maxdepth: 2136137api138```139140# About Project141142- This documentation is structured according to [Diataxis](https://diataxis.fr/) and written with [MyST](https://myst-parser.readthedocs.io/en/latest/)143- [Version Policy](https://palletsprojects.com/versions)144- [Donate](https://palletsprojects.com/donate)145146```{toctree}147:maxdepth: 1148149contributing150contrib151license152changes153```