Skip to content
Myr

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

9 files+83 added−134 removed

modified:docs/documentation.rst+2 added-1 removed
197 unmodified lines
198.. code-block:: python199200 cli(max_content_width=120)201202.. _doc-meta-variables:202203204Truncating Help Texts205---------------------206207Click 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 lines
221.. click:run::222223 invoke(cli, args=['--help'])224225.. _doc-meta-variables:226227Placeholder / Meta Variable228-----------------------------229
39 unmodified lines
modified:docs/entry-points.rst+1 added-1 removed
53 unmodified lines
54 "click>=8.1",55 ]5657 [project.scripts]58 hello = "hello:cli"58 hello = "hello.hello:cli"5960 [build-system]61 requires = ["flit_core<4"]62 build-backend = "flit_core.buildapi"
25 unmodified lines
modified:docs/index.rst+7 added-7 removed
56 unmodified lines
5758 pip install click5960Documentation61-------------61==============6263.. toctree::64 :maxdepth: 26566 faqs6768Tutorials69^^^^^^^^^^^^^69------------70.. toctree::71 :maxdepth: 17273 quickstart74 virtualenv7576How to Guides77^^^^^^^^^^^^^77---------------78.. toctree::79 :maxdepth: 18081 entry-points82 setuptools83 support-multiple-versions8485Conceptual Guides86^^^^^^^^^^^^^^^^^^^86-------------------87.. toctree::88 :maxdepth: 18990 why91 click-concepts9293General Reference94^^^^^^^^^^^^^^^^^^^94--------------------9596.. toctree::97 :maxdepth: 198
17 unmodified lines
116 unicode-support117 wincmd118119API Reference120^^^^^^^^^^^^^^^120-------------------121122.. toctree::123 :maxdepth: 2124125 api126127About Project128-------------------128===============129130* This documentation is structured according to `Diataxis <https://diataxis.fr/>`_131132* `Version Policy <https://palletsprojects.com/versions>`_
11 unmodified lines
deleted:docs/make.bat-36 removed
1@ECHO OFF23pushd %~dp045REM Command file for Sphinx documentation67if "%SPHINXBUILD%" == "" (8 set SPHINXBUILD=sphinx-build9)10set SOURCEDIR=.11set BUILDDIR=_build12set SPHINXPROJ=Jinja1314if "%1" == "" goto help1516%SPHINXBUILD% >NUL 2>NUL17if 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)2829%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%30goto end3132:help33%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%3435:end36popd
deleted:docs/Makefile-20 removed
1# Minimal makefile for Sphinx documentation2#34# You can set these variables from the command line.5SPHINXOPTS =6SPHINXBUILD = sphinx-build7SPHINXPROJ = Jinja8SOURCEDIR = .9BUILDDIR = _build1011# Put it first so that "make" without argument is like "make help".12help:13 @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)1415.PHONY: help Makefile1617# 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 lines
151(tuple-type)=152153## Multi Value Options as Tuples154155:::{versionadded} 4.0156:::155```{versionadded} 4.0156```157158As you can see that by using `nargs` set to a specific number each item in159the resulting tuple is of the same type. This might not be what you want.160Commonly you might want to use different types for different indexes in
127 unmodified lines
288 def log(debug):289 click.echo(f"debug={debug}")290```291292:::{versionchanged} 6.0293:::292```{versionchanged} 6.0293```294295If you want to define an alias for the second option only, then you will need to use leading whitespace to disambiguate the format string.296297```{eval-rst}
133 unmodified lines
431providing only the option's flag without a value will either show a432prompt or use its `flag_value`.433434Setting `is_flag=False, flag_value=value` tells Click that the option435can still be passed a value, but only if the flag is given the436`flag_value`.435can still be passed a value, but if only the flag is given, the436value will be `flag_value`.437438```{eval-rst}439.. click:example::440
11 unmodified lines
added:docs/parameters.md+55 added
deleted:docs/parameters.rst-58 removed
1.. _parameters:23Parameters4==========56.. currentmodule:: click78Click supports only two principle types of parameters for scripts (by design): options and arguments.910Options11----------------1213* 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.2021Arguments22----------------2324* 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`.2930On 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.3132.. _parameter_names:3334Parameter Names35---------------3637Parameters (options and arguments) have a name that will be used as38the Python argument name when calling the decorated function with39values.4041.. click:example::4243 @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)5051In 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`.52The option's names are ``-t`` and ``--times``. More names are available for options and are covered in :ref:`options`.5354And what it looks like when run:5556.. click:run::5758 invoke(multi_echo, ['--times=3', 'index.txt'], prog_name='multi_echo')
modified:.readthedocs.yaml+12 added-5 removed
1version: 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-process45build: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