Merge branch 'stable'
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parents c9e9413, b8b9ffe · Browse files · 7 files·+171 added−162 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+171 added−162 removed
- other:+171 added−162 removed
Provenance
- Commit
a9a218c- Tree
b802ef0- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent 1
c9e9413- Parent 2
b8b9ffe
7 files changed+171 added−162 removed
added:docs/changes.md+5 added
12345# Changes
```{eval-rst}.. include:: ../CHANGES.rst```deleted:docs/changes.rst-4 removed
1-Changes2-=======3-4-.. include:: ../CHANGES.rstadded:docs/index.md+152 added
1+#2+3+```{image} _static/click-name.svg4+:align: center5+:height: 200px6+```7+8+Click is a Python package for creating beautiful command line interfaces9+in a composable way with as little code as necessary. It's the "Command10+Line Interface Creation Kit". It's highly configurable but comes with11+sensible defaults out of the box.12+13+It aims to make the process of writing command line tools quick and fun14+while also preventing any frustration caused by the inability to implement15+an intended CLI API.16+17+Click in three points:18+19+- arbitrary nesting of commands20+- automatic help page generation21+- supports lazy loading of subcommands at runtime22+23+What does it look like? Here is an example of a simple Click program:24+25+```{eval-rst}26+.. click:example::27+28+ import click29+30+ @click.command()31+ @click.option('--count', default=1, help='Number of greetings.')32+ @click.option('--name', prompt='Your name',33+ help='The person to greet.')34+ def hello(count, name):35+ """Simple program that greets NAME for a total of COUNT times."""36+ for x in range(count):37+ click.echo(f"Hello {name}!")38+39+ if __name__ == '__main__':40+ hello()41+42+43+And what it looks like when run:44+45+46+.. click:run::47+48+ invoke(hello, ['--count=3'], prog_name='python hello.py', input='John\n')49+50+51+It automatically generates nicely formatted help pages:52+53+54+.. click:run::55+56+ invoke(hello, ['--help'], prog_name='python hello.py')57+```58+59+You can get the library directly from PyPI:60+61+```62+pip install click63+```64+65+# Documentation66+67+```{toctree}68+:maxdepth: 269+70+faqs71+```72+73+## Tutorials74+75+```{toctree}76+:maxdepth: 177+78+quickstart79+virtualenv80+```81+82+## How to Guides83+84+```{toctree}85+:maxdepth: 186+87+entry-points88+setuptools89+standalone-apps90+upgrade-guides91+support-multiple-versions92+```93+94+## Conceptual Guides95+96+```{toctree}97+:maxdepth: 198+99+design-opinions100+why101+click-concepts102+```103+104+## General Reference105+106+```{toctree}107+:maxdepth: 1108+109+parameters110+parameter-types111+options112+option-decorators113+arguments114+commands-and-groups115+commands116+documentation117+prompts118+handling-files119+advanced120+complex121+extending-click122+testing123+utils124+shell-completion125+exceptions126+command-line-reference127+unicode-support128+wincmd129+```130+131+## API Reference132+133+```{toctree}134+:maxdepth: 2135+136+api137+```138+139+# About Project140+141+- This documentation is structured according to [Diataxis](https://diataxis.fr/) and written with [MyST](https://myst-parser.readthedocs.io/en/latest/)142+- [Version Policy](https://palletsprojects.com/versions)143+- [Donate](https://palletsprojects.com/donate)144+145+```{toctree}146+:maxdepth: 1147+148+contributing149+contrib150+license151+changes152+```deleted:docs/index.rst-145 removed
1-.. rst-class:: hide-header2-3-Welcome to Click4-================5-6-.. image:: _static/click-name.svg7- :align: center8- :height: 200px9-10-Click is a Python package for creating beautiful command line interfaces11-in a composable way with as little code as necessary. It's the "Command12-Line Interface Creation Kit". It's highly configurable but comes with13-sensible defaults out of the box.14-15-It aims to make the process of writing command line tools quick and fun16-while also preventing any frustration caused by the inability to implement17-an intended CLI API.18-19-Click in three points:20-21-- arbitrary nesting of commands22-- automatic help page generation23-- supports lazy loading of subcommands at runtime24-25-What does it look like? Here is an example of a simple Click program:26-27-.. click:example::28-29- import click30-31- @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}!")39-40- if __name__ == '__main__':41- hello()42-43-And what it looks like when run:44-45-.. click:run::46-47- invoke(hello, ['--count=3'], prog_name='python hello.py', input='John\n')48-49-It automatically generates nicely formatted help pages:50-51-.. click:run::52-53- invoke(hello, ['--help'], prog_name='python hello.py')54-55-You can get the library directly from PyPI::56-57- pip install click58-59-Documentation60-==============61-62-.. toctree::63- :maxdepth: 264-65- faqs66-67-Tutorials68-------------69-.. toctree::70- :maxdepth: 171-72- quickstart73- virtualenv74-75-How to Guides76----------------77-.. toctree::78- :maxdepth: 179-80- entry-points81- setuptools82- standalone-apps83- upgrade-guides84- support-multiple-versions85-86-Conceptual Guides87--------------------88-.. toctree::89- :maxdepth: 190-91- design-opinions92- why93- click-concepts94-95-General Reference96---------------------97-98-.. toctree::99- :maxdepth: 1100-101- parameters102- parameter-types103- options104- option-decorators105- arguments106- commands-and-groups107- commands108- documentation109- prompts110- handling-files111- advanced112- complex113- extending-click114- testing115- utils116- shell-completion117- exceptions118- command-line-reference119- unicode-support120- wincmd121-122-API Reference123--------------------124-125-.. toctree::126- :maxdepth: 2127-128- api129-130-About Project131-===============132-133-* This documentation is structured according to `Diataxis <https://diataxis.fr/>`_ and written with `MyST <https://myst-parser.readthedocs.io/en/latest/>`_134-135-* `Version Policy <https://palletsprojects.com/versions>`_136-137-* `Donate <https://palletsprojects.com/donate>`_138-139-.. toctree::140- :maxdepth: 1141-142- contributing143- contrib144- license145- changesmodified:docs/quickstart.md+7 added-7 removed
140 unmodified linesExpand all14114214314414514614714514614714814915015115215315115215315415515515615715815937 unmodified lines140 unmodified linesExpand alland registered with a group later with `group.add_command()`. This could be used to split commands into multiple Pythonmodules.
```{code-block} python @click.command() def greet(): click.echo("Hello, World!")@click.command()def greet(): click.echo("Hello, World!")```
```{code-block} python @click.group() def group(): pass@click.group()def group(): pass
group.add_command(greet)group.add_command(greet)```
## Adding Parameters
37 unmodified linesmodified:docs/wincmd.md+6 added-4 removed
21 unmodified lines22 used for parameters.23 24 ## Unicode Output and Input25 26-Unicode output and input on Windows is implemented through the concept of a dispatching text stream. What this means is27-that when click first needs a text output (or input) stream on windows it goes through a few checks to figure out of a28-windows console is connected or not. If no Windows console is present then the text output stream is returned as such29-and the encoding for that stream is set to `utf-8` like on all platforms.26+Unicode output and input on Windows is implemented through the concept of a27+dispatching text stream. This means that when click first needs a text output28+(or input) stream on windows it goes through a few checks to figure out if a29+windows console is connected or not. If no Windows console is present then the30+text output stream is returned as such and the encoding for that stream is set31+to `utf-8` like on all platforms.32 33 However if a console is connected the stream will instead be emulated and use the cmd.exe unicode APIs to output text34 information. In this case the stream will also use `utf-16-le` as internal encoding. However there is some hackery going35 on that the underlying raw IO buffer is still bypassing the unicode APIs and byte output through an indirection is still14 unmodified linesmodified:CHANGES.rst+1 added-2 removed
1 .. currentmodule:: click2 3 Version 8.4.14-------------------4+-------------5 6 Unreleased7 8 9-9 Version 8.4.010 -------------11 12 Released 2026-05-171461 unmodified lines