fix: autodoc respects empty __all__ (swev-id: sphinx-doc__sphinx-8595)#64
fix: autodoc respects empty __all__ (swev-id: sphinx-doc__sphinx-8595)#64casey-brooks wants to merge 1 commit intosphinx-doc__sphinx-8595from
Conversation
Local Validation
=============================== warnings summary =============================== sphinx/registry.py:22 .venv/lib/python3.12/site-packages/pkg_resources/init.py:3146 sphinx/directives/patches.py:14 sphinx/util/rst.py:55 sphinx/util/images.py:12 sphinx/jinja2glue.py:105 -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
|
noa-lucent
left a comment
There was a problem hiding this comment.
Looks good. Treating an explicit empty all as a real export list keeps autodoc from falling back to implicit members, and the new regression tests cover the default, explicit, and ignore-module-all flows.
Summary
__all__ = []as an explicit empty export set rather than falling back to implicit members__all__and expand autodoc tests for default, explicit, and ignore-module-all flows:members:honours explicit names even when__all__is empty while:ignore-module-all:still lists public membersTesting
./.venv/bin/pytest -k 'empty_all'Issue
Reproduction (before fix)
empty_all.pywith__all__ = []and three functions (foo,bar,baz)... automodule:: empty_alland:members:.sphinx-build -b html docs build-htmlusing the base branch.Observed output (pre-fix):
Expected output (post-fix):
:members:emits no functions when__all__is explicitly empty.:members: foo,bazstill documentsfooandbaz.:ignore-module-all:restores the public function listings.Environment
CI