Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sphinx.ext.apidoc extension #13333

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented Feb 12, 2025

Purpose

A common use-case is that users simply want to point Sphinx towards a Python module, and have it generate documentation automatically.

This is not possible currently, without a "pre-build" step of running the sphinx-autogen CLI.

This PR adds sphinx.ext.apidoc as a sphinx extension, to incorporate the source file generation into the sphinx build.

https://sphinx--13333.org.readthedocs.build/en/13333/usage/extensions/apidoc.html#module-sphinx.ext.apidoc

References

chrisjsewell and others added 4 commits February 12, 2025 13:43
A common use-case is that users simply want to point Sphinx
towards a Python module, and have it generate documentation
automatically.

This is not possible currently, without a "pre-build" step
of running the `sphinx-autogen` CLI.

This PR adds `sphinx.ext.apidoc` as a sphinx extension,
to incorporate the source file generation into the sphinx build.

Co-authored-by: Adam Turner <[email protected]>
@chrisjsewell
Copy link
Member Author

chrisjsewell commented Feb 12, 2025

In addition to #12471 and #13220 this adds the apidoc_defaults config and a changelog entry

@AA-Turner
Copy link
Member

Feel free to push to the original PR branch in the future instead of opening a replacement PR, makes it easier to keep all review comments in the same place!

@AA-Turner
Copy link
Member

apidoc_defaults

Would you oppose splitting these out to one configuration option per default value? It's easier for typing and documentation to be more granular, but it is more verbose. This is also the approach taken by https://github.com/sphinx-contrib/apidoc.

A

@chrisjsewell
Copy link
Member Author

Would you oppose splitting these out to one configuration option per default value? It's easier for typing and documentation to be more granular, but it is more verbose.

so like apidoc_default_maxdepth, apidoc_default_followlinks, ...?

yeh err it is a bit verbose, and annoying to code 😅

thinking out loud; would it not be nicer to more generally allow app.add_config_value(.., types=x) to take a TypedDict, and modify check_confval_types to check against it?
This would be helpful for numerous core/extension configs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants