Skip to content
Myr

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

7 files+171 added−162 removed

added:docs/changes.md+5 added
deleted:docs/changes.rst-4 removed
1Changes2=======34.. include:: ../CHANGES.rst
added:docs/index.md+152 added
1#23```{image} _static/click-name.svg4:align: center5:height: 200px6```78Click is a Python package for creating beautiful command line interfaces9in a composable way with as little code as necessary. It's the "Command10Line Interface Creation Kit". It's highly configurable but comes with11sensible defaults out of the box.1213It aims to make the process of writing command line tools quick and fun14while also preventing any frustration caused by the inability to implement15an intended CLI API.1617Click in three points:1819- arbitrary nesting of commands20- automatic help page generation21- supports lazy loading of subcommands at runtime2223What does it look like? Here is an example of a simple Click program:2425```{eval-rst}26.. click:example::2728 import click2930 @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}!")3839 if __name__ == '__main__':40 hello()414243And what it looks like when run:444546.. click:run::4748 invoke(hello, ['--count=3'], prog_name='python hello.py', input='John\n')495051It automatically generates nicely formatted help pages:525354.. click:run::5556 invoke(hello, ['--help'], prog_name='python hello.py')57```5859You can get the library directly from PyPI:6061```62pip install click63```6465# Documentation6667```{toctree}68:maxdepth: 26970faqs71```7273## Tutorials7475```{toctree}76:maxdepth: 17778quickstart79virtualenv80```8182## How to Guides8384```{toctree}85:maxdepth: 18687entry-points88setuptools89standalone-apps90upgrade-guides91support-multiple-versions92```9394## Conceptual Guides9596```{toctree}97:maxdepth: 19899design-opinions100why101click-concepts102```103104## General Reference105106```{toctree}107:maxdepth: 1108109parameters110parameter-types111options112option-decorators113arguments114commands-and-groups115commands116documentation117prompts118handling-files119advanced120complex121extending-click122testing123utils124shell-completion125exceptions126command-line-reference127unicode-support128wincmd129```130131## API Reference132133```{toctree}134:maxdepth: 2135136api137```138139# About Project140141- 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)144145```{toctree}146:maxdepth: 1147148contributing149contrib150license151changes152```
deleted:docs/index.rst-145 removed
1.. rst-class:: hide-header23Welcome to Click4================56.. image:: _static/click-name.svg7 :align: center8 :height: 200px910Click is a Python package for creating beautiful command line interfaces11in a composable way with as little code as necessary. It's the "Command12Line Interface Creation Kit". It's highly configurable but comes with13sensible defaults out of the box.1415It aims to make the process of writing command line tools quick and fun16while also preventing any frustration caused by the inability to implement17an intended CLI API.1819Click in three points:2021- arbitrary nesting of commands22- automatic help page generation23- supports lazy loading of subcommands at runtime2425What does it look like? Here is an example of a simple Click program:2627.. 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()4243And what it looks like when run:4445.. click:run::4647 invoke(hello, ['--count=3'], prog_name='python hello.py', input='John\n')4849It automatically generates nicely formatted help pages:5051.. click:run::5253 invoke(hello, ['--help'], prog_name='python hello.py')5455You can get the library directly from PyPI::5657 pip install click5859Documentation60==============6162.. toctree::63 :maxdepth: 26465 faqs6667Tutorials68------------69.. toctree::70 :maxdepth: 17172 quickstart73 virtualenv7475How to Guides76---------------77.. toctree::78 :maxdepth: 17980 entry-points81 setuptools82 standalone-apps83 upgrade-guides84 support-multiple-versions8586Conceptual Guides87-------------------88.. toctree::89 :maxdepth: 19091 design-opinions92 why93 click-concepts9495General Reference96--------------------9798.. toctree::99 :maxdepth: 1100101 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 wincmd121122API Reference123-------------------124125.. toctree::126 :maxdepth: 2127128 api129130About Project131===============132133* This documentation is structured according to `Diataxis <https://diataxis.fr/>`_ and written with `MyST <https://myst-parser.readthedocs.io/en/latest/>`_134135* `Version Policy <https://palletsprojects.com/versions>`_136137* `Donate <https://palletsprojects.com/donate>`_138139.. toctree::140 :maxdepth: 1141142 contributing143 contrib144 license145 changes
modified:docs/quickstart.md+7 added-7 removed
modified:docs/wincmd.md+6 added-4 removed
21 unmodified lines
22used for parameters.2324## Unicode Output and Input2526Unicode output and input on Windows is implemented through the concept of a dispatching text stream. What this means is27that when click first needs a text output (or input) stream on windows it goes through a few checks to figure out of a28windows console is connected or not. If no Windows console is present then the text output stream is returned as such29and the encoding for that stream is set to `utf-8` like on all platforms.26Unicode output and input on Windows is implemented through the concept of a27dispatching 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 a29windows console is connected or not. If no Windows console is present then the30text output stream is returned as such and the encoding for that stream is set31to `utf-8` like on all platforms.3233However if a console is connected the stream will instead be emulated and use the cmd.exe unicode APIs to output text34information. In this case the stream will also use `utf-16-le` as internal encoding. However there is some hackery going35on that the underlying raw IO buffer is still bypassing the unicode APIs and byte output through an indirection is still
14 unmodified lines
modified:CHANGES.rst+1 added-2 removed
1.. currentmodule:: click23Version 8.4.14------------------4-------------56Unreleased7899Version 8.4.010-------------1112Released 2026-05-17
1461 unmodified lines