Merge branch 'stable' into rst2myst
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Jaron Rosenau · committed by GitHub · parents 29eb946, 499bbee · Browse files · 9 files·+83 added−134 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
9 files+83 added−134 removed
- other:+83 added−134 removed
Provenance
- Commit
db4bb67- Tree
d88c247- Author
Jaron Rosenau <jaron.rosenau@gmail.com>- Committer
GitHub <noreply@github.com>- Parent 1
29eb946- Parent 2
499bbee
9 files changed+83 added−134 removed
modified:docs/documentation.rst+2 added-1 removed
197 unmodified lines198 .. code-block:: python199 200 cli(max_content_width=120)201 202-.. _doc-meta-variables:202 203+204 Truncating Help Texts205 ---------------------206 207 Click gets :class:`Command` help text from the docstring. If you do not want to include part of the docstring, add the ``\f`` escape marker to have Click truncate the help text after the marker.13 unmodified lines221 .. click:run::222 223 invoke(cli, args=['--help'])224 225+.. _doc-meta-variables:226 227 Placeholder / Meta Variable228 -----------------------------229 39 unmodified linesmodified:docs/entry-points.rst+1 added-1 removed
53 unmodified lines54 "click>=8.1",55 ]56 57 [project.scripts]58- hello = "hello:cli"58+ hello = "hello.hello:cli"59 60 [build-system]61 requires = ["flit_core<4"]62 build-backend = "flit_core.buildapi"25 unmodified linesmodified:docs/index.rst+7 added-7 removed
56 unmodified lines57 58 pip install click59 60 Documentation61--------------61+==============62 63 .. toctree::64 :maxdepth: 265 66 faqs67 68 Tutorials69-^^^^^^^^^^^^^69+------------70 .. toctree::71 :maxdepth: 172 73 quickstart74 virtualenv75 76 How to Guides77-^^^^^^^^^^^^^77+---------------78 .. toctree::79 :maxdepth: 180 81 entry-points82 setuptools83 support-multiple-versions84 85 Conceptual Guides86-^^^^^^^^^^^^^^^^^^^86+-------------------87 .. toctree::88 :maxdepth: 189 90 why91 click-concepts92 93 General Reference94-^^^^^^^^^^^^^^^^^^^94+--------------------95 96 .. toctree::97 :maxdepth: 198 17 unmodified lines116 unicode-support117 wincmd118 119 API Reference120-^^^^^^^^^^^^^^^120+-------------------121 122 .. toctree::123 :maxdepth: 2124 125 api126 127 About Project128--------------------128+===============129 130 * This documentation is structured according to `Diataxis <https://diataxis.fr/>`_131 132 * `Version Policy <https://palletsprojects.com/versions>`_11 unmodified linesdeleted:docs/make.bat-36 removed
1-@ECHO OFF2-3-pushd %~dp04-5-REM Command file for Sphinx documentation6-7-if "%SPHINXBUILD%" == "" (8- set SPHINXBUILD=sphinx-build9-)10-set SOURCEDIR=.11-set BUILDDIR=_build12-set SPHINXPROJ=Jinja13-14-if "%1" == "" goto help15-16-%SPHINXBUILD% >NUL 2>NUL17-if errorlevel 9009 (18- echo.19- echo.The 'sphinx-build' command was not found. Make sure you have Sphinx20- echo.installed, then set the SPHINXBUILD environment variable to point21- echo.to the full path of the 'sphinx-build' executable. Alternatively you22- echo.may add the Sphinx directory to PATH.23- echo.24- echo.If you don't have Sphinx installed, grab it from25- echo.http://sphinx-doc.org/26- exit /b 127-)28-29-%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%30-goto end31-32-:help33-%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%34-35-:end36-popddeleted:docs/Makefile-20 removed
1-# Minimal makefile for Sphinx documentation2-#3-4-# You can set these variables from the command line.5-SPHINXOPTS =6-SPHINXBUILD = sphinx-build7-SPHINXPROJ = Jinja8-SOURCEDIR = .9-BUILDDIR = _build10-11-# Put it first so that "make" without argument is like "make help".12-help:13- @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)14-15-.PHONY: help Makefile16-17-# Catch-all target: route all unknown targets to Sphinx using the new18-# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).19-%: Makefile20- @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)modified:docs/options.md+6 added-6 removed
150 unmodified lines151 (tuple-type)=152 153 ## Multi Value Options as Tuples154 155-:::{versionadded} 4.0156-:::155+```{versionadded} 4.0156+```157 158 As you can see that by using `nargs` set to a specific number each item in159 the resulting tuple is of the same type. This might not be what you want.160 Commonly you might want to use different types for different indexes in127 unmodified lines288 def log(debug):289 click.echo(f"debug={debug}")290 ```291 292-:::{versionchanged} 6.0293-:::292+```{versionchanged} 6.0293+```294 295 If you want to define an alias for the second option only, then you will need to use leading whitespace to disambiguate the format string.296 297 ```{eval-rst}133 unmodified lines431 providing only the option's flag without a value will either show a432 prompt or use its `flag_value`.433 434 Setting `is_flag=False, flag_value=value` tells Click that the option435-can still be passed a value, but only if the flag is given the436-`flag_value`.435+can still be passed a value, but if only the flag is given, the436+value will be `flag_value`.437 438 ```{eval-rst}439 .. click:example::440 11 unmodified linesadded:docs/parameters.md+55 added
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455(parameters)=
# Parameters
```{currentmodule} click```
Click supports only two principle types of parameters for scripts (by design): options and arguments.
## Options
- Are optional.- Recommended to use for everything except subcommands, urls, or files.- Can take a fixed number of arguments. The default is 1. They may be specified multiple times using {ref}`multiple-options`.- Are fully documented by the help page.- Have automatic prompting for missing input.- Can act as flags (boolean or otherwise).- Can be pulled from environment variables.
## Arguments
- Are optional with in reason, but not entirely so.- Recommended to use for subcommands, urls, or files.- Can take an arbitrary number of arguments.- Are not fully documented by the help page since they may be too specific to be automatically documented. For more see {ref}`documenting-arguments`.- Can be pulled from environment variables but only explicitly named ones. For more see {ref}`environment-variables`.
On each principle type you can specify {ref}`parameter-types`. Specifying these types helps Click add details to your help pages and help with the handling of those types.
(parameter-names)=
## Parameter Names
Parameters (options and arguments) have a name that will be used asthe Python argument name when calling the decorated function withvalues.
In the example, the argument's name is `filename`. The name must match the python arg name. To provide a different name for use in help text, see {ref}`doc-meta-variables`.The option's names are `-t` and `--times`. More names are available for options and are covered in {ref}`options`.
```{eval-rst}.. click:example::
@click.command() @click.argument('filename') @click.option('-t', '--times', type=int) def multi_echo(filename, times): """Print value filename multiple times.""" for x in range(times): click.echo(filename)
.. click:run::
invoke(multi_echo, ['--times=3', 'index.txt'], prog_name='multi_echo')```deleted:docs/parameters.rst-58 removed
1-.. _parameters:2-3-Parameters4-==========5-6-.. currentmodule:: click7-8-Click supports only two principle types of parameters for scripts (by design): options and arguments.9-10-Options11-----------------12-13-* Are optional.14-* Recommended to use for everything except subcommands, urls, or files.15-* Can take a fixed number of arguments. The default is 1. They may be specified multiple times using :ref:`multiple-options`.16-* Are fully documented by the help page.17-* Have automatic prompting for missing input.18-* Can act as flags (boolean or otherwise).19-* Can be pulled from environment variables.20-21-Arguments22-----------------23-24-* Are optional with in reason, but not entirely so.25-* Recommended to use for subcommands, urls, or files.26-* Can take an arbitrary number of arguments.27-* Are not fully documented by the help page since they may be too specific to be automatically documented. For more see :ref:`documenting-arguments`.28-* Can be pulled from environment variables but only explicitly named ones. For more see :ref:`environment-variables`.29-30-On each principle type you can specify :ref:`parameter-types`. Specifying these types helps Click add details to your help pages and help with the handling of those types.31-32-.. _parameter_names:33-34-Parameter Names35----------------36-37-Parameters (options and arguments) have a name that will be used as38-the Python argument name when calling the decorated function with39-values.40-41-.. click:example::42-43- @click.command()44- @click.argument('filename')45- @click.option('-t', '--times', type=int)46- def multi_echo(filename, times):47- """Print value filename multiple times."""48- for x in range(times):49- click.echo(filename)50-51-In the above example the argument's name is ``filename``. The name must match the python arg name. To provide a different name for use in help text, see :ref:`doc-meta-variables`.52-The option's names are ``-t`` and ``--times``. More names are available for options and are covered in :ref:`options`.53-54-And what it looks like when run:55-56-.. click:run::57-58- invoke(multi_echo, ['--times=3', 'index.txt'], prog_name='multi_echo')modified:.readthedocs.yaml+12 added-5 removed
1 version: 22+# Do not specify sphinx key here to be in full control of build steps.3+# https://docs.readthedocs.com/platform/stable/build-customization.html#extend-or-override-the-build-process4+5 build:6 os: ubuntu-24.047 tools:8 python: '3.13'6- commands:7- - asdf plugin add uv8- - asdf install uv latest9- - asdf global uv latest10- - uv run --group docs sphinx-build -W -b dirhtml docs $READTHEDOCS_OUTPUT/html9+ jobs:10+ install:11+ - echo "Installing dependencies"12+ - asdf plugin add uv13+ - asdf install uv latest14+ - asdf global uv latest15+ build:16+ html:17+ - uv run --group docs sphinx-build -W -b dirhtml docs $READTHEDOCS_OUTPUT/html