Skip to content

docs: Generate libpython API docs only under the grass namespace - #7740

Merged
echoix merged 1 commit into
OSGeo:mainfrom
wenzeslaus:sphinx-drop-legacy-namespaces
Jul 17, 2026
Merged

echoix merged 1 commit into
OSGeo:mainfrom
wenzeslaus:sphinx-drop-legacy-namespaces

Conversation

@wenzeslaus

Copy link
Copy Markdown
Member

The Sphinx build of the Python library originally documented every subpackage under a stripped namespace (pygrass, script, temporal, ...). Then we added the top-level namespace grass to match the documentation with the code (full, preferred one, such as grass.pygrass and grass.script). Now is the time to keep only the grass.* documentation pages (after release, new documentation, other Sphinx cleanups).

This is a follow-up to #7526 and removes the warnings about the subpackages packages being documented twice.

Details

Drop the seven per-subpackage sphinx-apidoc runs and the sys.path entries in conf.py that made the modules importable under their stripped names, and point the handwritten pages, the theme navigation and the links in doc/ at the grass.* pages and modules.

This removes 22 of the 42 Sphinx warnings. All ten "more than one target
found for cross-reference" warnings (Table, GrassTestFilesMultiReporter)
are gone, since they were caused purely by the duplicate generation, as
are the docstring warnings which were reported once per spelling.

The three remaining "duplicate object description" warnings (Module,
MultiModule, ParallelModuleQueue) are not caused by the stripped
namespace: grass.pygrass.modules re-exports these classes, so autodoc
documents them both on the package page and on the page of the module
defining them. They are left for a separate change.

This change was prepared with the assistance of Claude Code.

The Sphinx build of the Python library documented every subpackage
twice: once under a stripped namespace (pygrass, script, temporal, ...)
and once under the full, preferred one (grass.pygrass, grass.script,
...). Keep only the grass.* pages.

Drop the seven per-subpackage sphinx-apidoc runs and the sys.path
entries in conf.py that made the modules importable under their stripped
names, and point the handwritten pages, the theme navigation and the
links in doc/ at the grass.* pages and modules.

This removes 22 of the 42 Sphinx warnings. All ten "more than one target
found for cross-reference" warnings (Table, GrassTestFilesMultiReporter)
are gone, since they were caused purely by the duplicate generation, as
are the docstring warnings which were reported once per spelling.

The three remaining "duplicate object description" warnings (Module,
MultiModule, ParallelModuleQueue) are not caused by the stripped
namespace: grass.pygrass.modules re-exports these classes, so autodoc
documents them both on the package page and on the page of the module
defining them. They are left for a separate change.

This change was prepared with the assistance of Claude Code.
@wenzeslaus wenzeslaus added this to the 8.6.0 milestone Jul 17, 2026
@github-actions github-actions Bot added Python Related code is in Python libraries docs markdown Related to markdown, markdown files notebook labels Jul 17, 2026

@echoix echoix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this, it might be possible to retry using a static configuration of sphinx.ext.apidoc (instead of caling a command line tool apidoc from a makefile), some work that I tried to do in June 2025, but was impossible to configure correctly because of the complex mapping that was needed, and the fact that that new Sphinix isolated extension didn't support of the required configs that was available in the old way. My PR finally never got merged sphinx-doc/sphinx#13668

@echoix
echoix merged commit 0b25cf0 into OSGeo:main Jul 17, 2026
26 checks passed
@wenzeslaus
wenzeslaus deleted the sphinx-drop-legacy-namespaces branch July 17, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs libraries markdown Related to markdown, markdown files notebook Python Related code is in Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants