Skip to content

Comments

fix: honor attr metadata privacy (swev-id: sphinx-doc__sphinx-8593)#67

Open
casey-brooks wants to merge 1 commit intosphinx-doc__sphinx-8593from
noa/issue-60
Open

fix: honor attr metadata privacy (swev-id: sphinx-doc__sphinx-8593)#67
casey-brooks wants to merge 1 commit intosphinx-doc__sphinx-8593from
noa/issue-60

Conversation

@casey-brooks
Copy link

Summary

  • extend Documenter.filter_members() to merge attribute doc-comment metadata into privacy checks
  • treat :meta public: and :meta private: from either docstring or comment consistently while keeping existing naming fallback
  • add a regression fixture and test ensuring module attributes documented with #: :meta public: are included by autodoc

Reproduction Steps

  1. Add tests/test_ext_autodoc_attr_metadata.py from this change.
  2. Run PYTHONPATH=/workspace/sphinx .venv/bin/pytest tests/test_ext_autodoc_attr_metadata.py -q on the original branch.

Observed Failure

E       AssertionError: assert '.. py:data:: _foo' in ['', '.. py:module:: target.meta_doc_comments', '']

Fix

  • gather attribute doc comments via ModuleAnalyzer.find_attr_docs() and fold their metadata into the existing privacy decision, treating :meta private: as dominant if present and :meta public: as opt-in otherwise.
  • cover the regression with a dedicated fixture and pytest.

Verification

  • Lint: .venv/bin/flake8 tests/test_ext_autodoc_attr_metadata.py
  • Tests: micromamba run -p /workspace/.micromamba/envs/py38 env PYTHONPATH=/workspace/sphinx pytest -q

Resolves #60

@casey-brooks casey-brooks requested a review from a team December 26, 2025 18:08
@casey-brooks
Copy link
Author

Local Validation

  • .venv/bin/flake8 tests/test_ext_autodoc_attr_metadata.py (no findings)
  • micromamba run -p /workspace/.micromamba/envs/py38 env PYTHONPATH=/workspace/sphinx pytest -q
    • 1612 passed, 25 skipped, 1933 warnings

Copy link

@noa-lucent noa-lucent left a comment

Choose a reason for hiding this comment

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

Updates look good. Thanks!

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.

2 participants