-
Notifications
You must be signed in to change notification settings - Fork 138
Use sphinx-autoapi to generate API documentation #3646
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
Open
valeriupredoi
wants to merge
55
commits into
main
Choose a base branch
from
use_sphinx-autoapi
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
7b712cc
add autoapi gubbins to sonf.py
valeriupredoi 2623191
first draft of readthedocs config file for autoapi
valeriupredoi 53e81a3
actually remove the pip bit
valeriupredoi fe20722
correct path to source code
valeriupredoi 55ae5a7
try with a temporary version placeholder
valeriupredoi 1cf623c
rm autodocsumm
valeriupredoi 4001b3f
duh correct RTD syntax for extension
valeriupredoi bf35f94
add independent requirements file
valeriupredoi 9384eb9
revert extension name
valeriupredoi 26e6edb
call the autoapi module installation from a separate requirements file
valeriupredoi 1b17448
add theme dep to requirements
valeriupredoi 9e41e1b
throw some configuration at autoapi
valeriupredoi 3cb33ef
exclude diag_scripts
valeriupredoi 9324b25
add only select api elements to be documented
valeriupredoi bd12331
comment out all autodoc settings
valeriupredoi 09b81ad
turn off generation of index.rst and set the autoapi root dir
valeriupredoi 5b7d23d
remove that silly index.rst already!
valeriupredoi 5eb2186
maybe we want that index.rst after all
valeriupredoi 8a2dfa2
try shove a sys appended path for autodoc
valeriupredoi e75d0c3
try shove a sys appended path for autodoc
valeriupredoi b22ca27
fix that terrible previous commit
valeriupredoi f07c760
Disable autodoc and select only wanted submodules with autoapi
bouweandela c546796
remove autodocsumm and pydata sphinx theme dependencies
valeriupredoi 9901882
remove autodocsumm and pydata sphinx theme dependencies
valeriupredoi 0c0059f
add ignore to autoapi congig
valeriupredoi c3d14fe
correct wildcard
valeriupredoi 3ea9878
Add __init__.py files and add __all__
bouweandela 06b55b9
Merge branch 'use_sphinx-autoapi' of https://github.com/ESMValGroup/Eβ¦
valeriupredoi 01fd8fc
add testkw to the ignored list
valeriupredoi 1d2ed6b
nevermind, am stoopid
valeriupredoi 9f18b66
add names.py to ignores
valeriupredoi 9f85e78
reinstate names.py
valeriupredoi b49b34c
comment out import in sraed init
valeriupredoi a0584e8
comment out all imports from shared init
valeriupredoi e791641
reinstate some imports
valeriupredoi d6fce5b
Comment out ignores
bouweandela 6392e27
Fix formatting
bouweandela 024896a
Fix some warnings
bouweandela 9719bca
Fix docs build
bouweandela f9a568f
make package level imports
valeriupredoi 53e7f91
make package level imports
valeriupredoi 9c57a60
make package level imports
valeriupredoi c6c3a3a
make package level imports
valeriupredoi 0d4f069
make package level imports
valeriupredoi eea6b00
make package level imports
valeriupredoi a9edecb
make package level imports
valeriupredoi 5493f41
make package level imports
valeriupredoi ae53507
Merge branch 'main' into use_sphinx-autoapi
valeriupredoi a14d7e1
Merge branch 'main' into use_sphinx-autoapi
valeriupredoi 08a5eba
correct for souble import
valeriupredoi 5dc083e
correct for souble import
valeriupredoi 7408d99
couple more conflict fixing bloopers
valeriupredoi ac86b9e
Merge branch 'main' into use_sphinx-autoapi
valeriupredoi ccfde85
Merge branch 'main' into use_sphinx-autoapi
valeriupredoi c228572
Merge branch 'main' into use_sphinx-autoapi
valeriupredoi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pydata-sphinx-theme | ||
sphinx-autoapi |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible change this list so only these are documented? https://github.com/ESMValGroup/ESMValTool/tree/main/doc/sphinx/source/api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeh lemme add all those to the list that way then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it works nicely! Less than two minutes to run, but it throws 100+ warnings, see https://readthedocs.org/projects/esmvaltool/builds/24660091/ - I think I know what's going on in here - there are two types of warnings:
autodoc
which I should turn it off completelyautoapi
docs dir sitting inside oursource
so it's kicking its own butt since theautoapi
docs are not included in any docsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey Bouwe, any ideas how to fix these warnings? https://readthedocs.org/projects/esmvaltool/builds/24661254/ - I've done everything I could think of, and a tap dance on top of it too - autodoc keeps wanting to import modules, even though I added ESMValTool and esmvaltool to the Python path (that's just not how things should be done, but that's what the Sphinx folks say we should do), and the blithering autoapi keeps creating that
index.rst
even if I told it no withautoapi_generate_api_docs = False
(see https://sphinx-autoapi.readthedocs.io/en/latest/how_to.html). I am stuck, and am gonna leave it for now πUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I fixed the build in f07c760, but it is not pretty. Somehow I cannot get
autoapi
to respect what is in__all__
(see here). At least in part that seems to be because it also searches for executable scripts and documents those and those appear to be scattered throughout the code base. Maybe if we clean that up things will work better?We would still need to move the documentation from the now deleted
doc/sphinx/source/api
directory to the Python modules and do some further polishing before this is ready.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a serious bit of progress - from 126 to 7 warnings, bud πΊ But what do you mean moving the docs to the Python modules, as in create the docs in the same place where the source code lives? Lemme see about restricting Autoapi to not look for executables, that should have a configuration solution
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not executable scripts after all, it is missing
__init__.py
files that generate all the extra packages. Let me try to add some.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahaa! That's me completely unawares - it's great you figured that out otherwise it'd have taken me until 2027 to π So I figured out the
tests
issue and now I think I just need to add Katja'stestkw
to the ignored list tooThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy the text from the deleted .rst files to the module docstrings