Skip to content

fix(docs): resolve reST syntax and structural Sphinx build warnings#540

Open
petercorke wants to merge 3 commits into
mainfrom
docs/sphinx-build-cleanup
Open

fix(docs): resolve reST syntax and structural Sphinx build warnings#540
petercorke wants to merge 3 commits into
mainfrom
docs/sphinx-build-cleanup

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Summary

Full docs build went from 216 warnings/errors down to 5 (the deferred KinematicCache/SensorBase/jointset items, left for a follow-up runblock-code pass).

  • Jinja2 filter-precedence bug in the autosummary method template — the underline was sized to just the method name, not the full title, breaking all 39 generated IK stub pages.
  • Duplicate object descriptions (ik_GN/ik_LM/ik_NR/ikine_GN/ikine_LM) via :no-index: in the stub template.
  • A broken Examples/.. runblock:: docstring template repeated across BaseRobot.py, ETS.py, Link.py, ET.py, Dynamics.py: missing blank lines and un-indented directive bodies (making those examples inert — never actually executed).
  • 7 malformed reST tables sharing one column-width overflow bug.
  • A genuine Napoleon + sphinx_autodoc_typehints conflict (bare NumPy-style Note headers), root-caused via an isolated minimal Sphinx build. Confirmed Napoleon is still needed (tools/urdf/*.py has real vendored NumPy-style docstrings) — fixed the two affected Note headers instead of removing the extension.
  • Assorted one-offs: a Markdown pipe-table misparsed as reST substitution syntax, unclosed inline markup, bad list nesting/indentation, a bare URL parsed as a hyperlink target, an incomplete list-table row, **kwargs misparsed as bold.
  • Removed two pieces of dead config (suppress_warnings's bogus "duplicate" token, unused napoleon_custom_sections).

Two tech-debt entries logged for what's deliberately deferred: repeated :returns:/:param: fields, and the broader NumPy→reST docstring migration debt (48 vestigial See Also headers across 6 files).

Test plan

  • Full local Sphinx build after each round of fixes: 216 → 38 → 11 → 5 warnings/errors
  • python -m ast.parse on every modified file
  • Reinstalled and rebuilt from scratch before each verification pass

🤖 Generated with Claude Code

petercorke and others added 3 commits July 5, 2026 10:44
…llback tests

roboticstoolbox/robot/ETS.py defines a class also called ETS, and
robot/__init__.py's `from ...ETS import ETS` rebinds the "ETS"
attribute on the roboticstoolbox.robot package to the class, shadowing
the submodule of the same name. Python 3.10's unittest.mock resolves
dotted-string patch targets via plain getattr (falling back to import
only on AttributeError), so patch("...ETS.ETS_fkine", ...) resolved
"ETS" to the shadowing class and failed with AttributeError; 3.11+
uses pkgutil.resolve_name and isn't fooled by the same shadowing. This
is why it only ever showed up on Python 3.10 in CI.

Not a real code bug - the actual fknm/facade fallback machinery was
always fine, only the test's patch target resolution was broken on
3.10. Fixed by looking up the real module via sys.modules directly
(the only lookup with no getattr involved) and patching against that
with patch.object() instead of a dotted string.

Rehearsed: all 41 tests in test_fknm_fallback.py pass under both
Python 3.10 and 3.13.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Cross-references the fknm fallback test fix in this same branch.
Python 3.10 reaches EOL October 2026 — flag this specific workaround
for removal (and a general 3.10-specific-code sweep) at that point.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Full docs build went from 216 warnings/errors down to 5 (the deferred
KinematicCache/SensorBase/jointset items, left for the runblock-code
pass). Fixes span:

- Jinja2 filter-precedence bug in the autosummary method template
  ((class + '.' + name) | escape | underline) — the filter chain was
  only sizing the title underline to the method name, not the full
  "Class.method" title, breaking all 39 generated IK stub pages.
- Duplicate object descriptions (ik_GN/ik_LM/ik_NR/ikine_GN/ikine_LM
  documented both inline and via IK/stubs/) via :no-index: in the
  stub template.
- A broken Examples/.. runblock:: docstring template repeated across
  BaseRobot.py, ETS.py, Link.py, ET.py, Dynamics.py: missing blank
  lines before Examples/See Also, and un-indented runblock directive
  bodies (making those examples inert — never actually executed).
- 7 malformed reST tables in DHRobot.py/RobotKinematics.py sharing
  one column-width overflow bug (``iterations`` wider than its
  border).
- A genuine Napoleon + sphinx_autodoc_typehints conflict: bare
  NumPy-style "Note" headers mixed into otherwise-reST docstrings,
  root-caused via an isolated minimal Sphinx build bisecting the
  extension list. Confirmed Napoleon is still needed (tools/urdf/*.py
  has real vendored NumPy-style docstrings) — fixed by converting the
  two affected Note headers to .. rubric:: Notes instead.
- Assorted one-offs: a Markdown-style pipe table misparsed as reST
  substitution syntax, unclosed inline literals/interpreted text,
  under/over-indented bullet continuations breaking list structure,
  a bare URL parsed as an implicit hyperlink target, an incomplete
  list-table row, `**kwargs` in a field name misparsed as bold markup,
  a nested bullet list missing its blank-line separator.
- Removed two pieces of dead config: suppress_warnings' non-existent
  "duplicate" token (replaced with the real "ref.citation"), and
  napoleon_custom_sections listing an unused "Synopsis" section.

Logged two tech-debt entries for what's deliberately left for later:
repeated :returns:/:param: fields that don't trigger warnings but are
still wrong, and the broader NumPy-to-reST docstring migration debt
(48 vestigial "See Also" headers across 6 files sharing the same
Napoleon-conflict risk class as the Note bug).

Verified via a full local Sphinx build after each round of fixes, not
just spot-checking individual warnings.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

1 participant