Skip to content
Myr

index.rst

This file

Path

docs/index.rst

145 lines · 2.7 KiB

Last changed by

Add upgrade guide section.Edward Gbefore adoption73117fe

History of this file

Take it

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   upgrade-guides83   support-multiple-versions8485Conceptual Guides86-------------------87.. toctree::88   :maxdepth: 18990   design-opinions91   why92   click-concepts9394General Reference95--------------------9697.. toctree::98   :maxdepth: 199100   parameters101   parameter-types102   options103   option-decorators104   arguments105   commands-and-groups106   commands107   documentation108   prompts109   handling-files110   advanced111   complex112   extending-click113   testing114   utils115   shell-completion116   exceptions117   command-line-reference118   unicode-support119   wincmd120121API Reference122-------------------123124.. toctree::125   :maxdepth: 2126127   api128129About Project130===============131132* This documentation is structured according to `Diataxis <https://diataxis.fr/>`_133134* `Version Policy <https://palletsprojects.com/versions>`_135136* `Contributing <https://palletsprojects.com/contributing/>`_137138* `Donate <https://palletsprojects.com/donate>`_139140.. toctree::141   :maxdepth: 1142143   contrib144   license145   changes