Skip to content

fix: handle Sphinx 9.x new autodoc options key format and sentinels#688

Merged
rossbar merged 2 commits into
numpy:mainfrom
jschueller:issue671
May 22, 2026
Merged

fix: handle Sphinx 9.x new autodoc options key format and sentinels#688
rossbar merged 2 commits into
numpy:mainfrom
jschueller:issue671

Conversation

@jschueller
Copy link
Copy Markdown
Contributor

Sphinx 9.x's new non-legacy autodoc uses underscored keys (e.g., exclude_members) and the EMPTY sentinel instead of hyphenated keys (exclude-members) and the ALL sentinel used by older Sphinx. This caused :exclude-members: to be silently ignored by numpydoc, producing spurious py:obj reference target not found warnings for excluded inherited members in nitpicky mode.

  • Update ClassDoc.__init__ to check both exclude_members and exclude-members keys, and normalize EMPTY to ALL
  • Update mangle_docstrings to use vars() instead of the deprecated Mapping interface for _AutoDocumenterOptions

Closes #671

Sphinx 9.x's new non-legacy autodoc uses underscored keys
(e.g., `exclude_members`) and the `EMPTY` sentinel instead of
hyphenated keys (`exclude-members`) and the `ALL` sentinel used
by older Sphinx. This caused `:exclude-members:` to be silently
ignored by numpydoc, producing spurious `py:obj reference target
not found` warnings for excluded inherited members in nitpicky
mode.

- Update `ClassDoc.__init__` to check both `exclude_members`
  and `exclude-members` keys, and normalize `EMPTY` to `ALL`
- Update `mangle_docstrings` to use `vars()` instead of the
  deprecated Mapping interface for `_AutoDocumenterOptions`

Closes numpy#671
@larsoner
Copy link
Copy Markdown
Collaborator

Looks reasonable to me!

See any easy way to add a test? Maybe by triggering the WARNING log line from #671 and with capsys make sure WARNING isn't in the output anymore (but was in main)?

@jschueller jschueller force-pushed the issue671 branch 4 times, most recently from c4049d3 to 85f1af4 Compare May 21, 2026 14:56
@jschueller
Copy link
Copy Markdown
Contributor Author

done, we can test mangle_docstrings directly

Copy link
Copy Markdown
Contributor

@rossbar rossbar left a comment

Choose a reason for hiding this comment

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

LGTM too, thanks for digging into this @jschueller !

@rossbar rossbar merged commit 8079eb4 into numpy:main May 22, 2026
24 checks passed
@stefanv stefanv added this to the 1.10.0 milestone May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

py:obj reference target not found with sphinx 9.x

4 participants