Repository navigation
Conversation
The documentation tells library users to read the source of rope.refactor and friends, because there is no API reference. Generate one from the docstrings with sphinx-autoapi, which, unlike autosummary, does not need hand-written stubs for every module, and link it from the table of contents through a short "API reference" page that points to the main entry points. The reference documents public members, including those inherited from private base classes (e.g. Project gets do(), get_resource(), history, ... from _Project), but leaves imported members out, so that rope.base.ast does not document the whole stdlib ast again. napoleon parses the NumPy-style docstring sections, which would otherwise become section titles with duplicate labels, and an autoapi-skip-member hook documents only the first of names that are intentionally defined several times (try/except fallbacks, operator handlers in type_hinting). The documentation build stays free of warnings. library.rst now uses cross-references to the reference instead of literal names where it mentions rope modules, classes and functions in running text; section titles are left unchanged to keep their autosectionlabel anchors. This replaces the stale PR #797 and takes its idea and its sphinx-autoapi and intersphinx setup. Fixes: #796 Co-authored-by: Shahriar Heidrich <smheidrich@weltenfunktion.de>
mcepl
force-pushed
the
api-docs-autoapi
branch
from
November 23, 2026 21:01
a95e002 to
7e02654
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #973 +/- ##
=======================================
Coverage 95.44% 95.44%
=======================================
Files 134 134
Lines 26910 26910
=======================================
Hits 25685 25685
Misses 1225 1225 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
Description
Replaces #797 by @smheidrich, which went stale (credited as co-author). There is no API reference at the moment, and the library docs tell users to read the source of
rope.refactor. This PR generates one with sphinx-autoapi.Fixes #796
What changed
docs/conf.py: addsautoapi.extension,sphinx.ext.intersphinx(links to the Python docs) andsphinx.ext.napoleon.Projectshowsdo(),get_resource(),history, … from_Project.rope.base.astwould document the whole stdlibastagain.Parameters/Returnssections, which otherwise became headings with duplicate labels.autoapi-skip-memberhook documents only the first of names that are deliberately defined several times (try/exceptfallbacks, operator handlers intype_hinting.evaluate). Without it Sphinx reports duplicate object descriptions.autoapi.python_import_resolution: autoapi can't follow thefrom ast import *re-export inrope.base.ast.docs/api.rst: a short "API reference" page, linked from the main table of contents right after "Using rope as a library". It points to the main entry points and to the generated tree.docs/library.rst: fully qualified rope names in running text now link to the reference (:mod:,:class:,:func:). Section titles are unchanged, so theirautosectionlabelanchors stay stable. Unlike Add auto-generated API docs #797, this doesn't setdefault_role = "any", so existing single-backtick text keeps its meaning.pyproject.toml:sphinx-autoapi>=3in thedocextra, which Read the Docs installs.Validation
sphinx-build -b html docs <out>, with Sphinx 8.2.3, sphinx-autoapi 3.9.0, sphinx-rtd-theme 3.1.0 and sphinx-autodoc-typehints 3.13.2:master: 0 warnings. This branch: 0 warnings, for both a full and an incremental build. 97 API pages, about 2.4 MB of HTML.-n(nitpicky): every new cross-reference inlibrary.rstandapi.rstresolves. The remaining nitpicky warnings come from existing docstrings that mention private helper classes such as_Generateand_Inliner; Read the Docs doesn't build in nitpicky mode..rstfiles are deleted after the build (autoapi_keep_filesdefaults toFalse) and never show up in the source tree.Read the Docs preview: https://rope--973.org.readthedocs.build/en/973/ — the API reference page is linked from the navigation and leads to the generated tree, e.g.
rope.base.project.