Automatically generate CLI reference documentation via sphinx-click and a custom directive#355
Open
agriyakhetarpal wants to merge 7 commits into
Open
Automatically generate CLI reference documentation via sphinx-click and a custom directive#355agriyakhetarpal wants to merge 7 commits into
sphinx-click and a custom directive#355agriyakhetarpal wants to merge 7 commits into
Conversation
ryanking13
reviewed
May 27, 2026
Member
ryanking13
left a comment
There was a problem hiding this comment.
Thanks! Would it be able to hide some of the subcommands from the generation? I intentionally not included build-recipes, build-recipes-no-deps, skeleton subcommands as I don't want to distract users with recipe-related commands. Most of the users who are looking at that document don't need to be aware of the recipe.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed in #350 that our CLI reference page is likely to get outdated often, as we may forget to update it with new CLI flags and subcommands being added. This PR introduces an inline Sphinx extension with a directive that scans entry points added by
pyodide-buildinpyodide-cliand adds them to the page. See the PR preview: https://pyodide-build--355.org.readthedocs.build/en/355/reference/cli.htmlWe can also skip such automation if we want, but based on my experience writing customisations for the Sphinx build process, this will remain fairly stable and shouldn't break in the future. It also beats adding new commands manually, so I recommend keeping it :D
The extension doesn't support Sphinx 9 yet, as I noticed from this issue that I encountered: click-contrib/sphinx-click#159, which has a PR to fix it: click-contrib/sphinx-click#160. We don't need any cutting-edge features from Sphinx anyway and none of our extensions imposes a Sphinx >=9 bound, so we should be fine with 8.x. Also, the extension doesn't support Markdown, but that's easily workaroundable with
{eval-rst}: click-contrib/sphinx-click#127.Lastly, I dropped the
requirements-doc.txtfile, as it's kind of redundant with dependency groups now.