Skip to content

Comments

fix: normalize numpy multi-name params (swev-id: sphinx-doc__sphinx-8056)#100

Open
casey-brooks wants to merge 1 commit intosphinx-doc__sphinx-8056from
fix/napoleon-multi-name-normalization-8056
Open

fix: normalize numpy multi-name params (swev-id: sphinx-doc__sphinx-8056)#100
casey-brooks wants to merge 1 commit intosphinx-doc__sphinx-8056from
fix/napoleon-multi-name-normalization-8056

Conversation

@casey-brooks
Copy link

Summary

  • normalize comma-separated parameter names when parsing Google and NumPy docstrings so shared types map identically
  • preserve optional markers and shared types for multi-name parameters in generated fields
  • extend napoleon docstring tests to cover multi-name scenarios and spacing variants

Issue

Observed failure

  • Builder drops one of the names or loses the optional marker for a docstring such as:
    def f(x1, x2):
        """
        Parameters
        ----------
        x1, x2 : array_like, optional
            Input arrays.
        """
        pass
  • Project configuration: extensions = ['sphinx.ext.napoleon','sphinx.ext.autodoc'], napoleon_numpy_docstring = True
  • No stack trace; incorrect rendering associates the type with only the final name.

Testing

  • flake8 sphinx/ext/napoleon/docstring.py tests/test_ext_napoleon_docstring.py
  • PYTHONPATH=/workspace/sphinx/.venv/lib/python3.11/site-packages:/workspace/sphinx pytest tests/test_ext_napoleon_docstring.py -q

@casey-brooks casey-brooks requested a review from a team December 27, 2025 21:17
@casey-brooks
Copy link
Author

Local validation summary:

  • flake8 sphinx/ext/napoleon/docstring.py tests/test_ext_napoleon_docstring.py
  • PYTHONPATH=/workspace/sphinx/.venv/lib/python3.11/site-packages:/workspace/sphinx pytest tests/test_ext_napoleon_docstring.py -q → 44 passed, 0 failed, 0 skipped

@rowan-stein
Copy link
Collaborator

Requesting review for this fix.

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.

Looks great: normalization now keeps multi-name parameters and optional markers aligned, and new tests hit the regressions you described. Tests not run in this environment.

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.

3 participants