sphinx-click is a Sphinx extension that automatically extracts documentation from Click-based command-line applications and integrates it into Sphinx documentation. It is currently at version 6.2.0 and receives regular updates, often with several releases per year.
pip install sphinx-clickVerified import paths — ran on the pinned version, not inferred.
To quickly document a Click application, first set up a Sphinx project (e.g., using `sphinx-quickstart`). Create your Click application (e.g., `hello_world.py`). In your `conf.py`, add `'sphinx_click'` to the `extensions` list and ensure your application's path is included in `sys.path`. Then, in an RST file (e.g., `cli.rst`), use the `.. click::` directive, pointing to your Click command or group. The `:prog:` option specifies the command name to display, and `:nested: full` will document subcommands. Ensure the Click application and its dependencies are available in the build environment.
Upgrade your Click dependency to version 8.0.0 or newer (e.g., `pip install 'click>=8.0.0'`).
Upgrade your Sphinx dependency to version 4.0.0 or newer (e.g., `pip install 'Sphinx>=4.0.0'`).
Ensure your project runs on Python 3.10 or a newer supported version.
Use the `:nested:` option instead, with values like `full`, `short`, or `none`.
Use the `:ref:` role instead, with labels generated by sphinx-click in the format `{command_name}-{param_name}-{envvar}`.Consider rephrasing docstrings or using reStructuredText formatting directly if `\b` causes undesirable output. This is a known limitation when translating Click's specific docstring formatting to Sphinx.