Sphinx extension to support docstrings in Numpy format
Create a small utility that turns NumPy-style docstring sections into reStructuredText while cross-referencing type tokens. The renderer must honor alias rules, ignore rules, and default links so that type mentions become Sphinx-friendly references.
arr : ndarray, when aliases map ndarray to numpy.ndarray, the rendered output wraps numpy.ndarray in the default cross-reference role instead of ndarray. @testflag : boolean, when the ignore list includes boolean, the rendered output leaves boolean as plain text with no cross-reference markup. @testengine : CustomEngine, with no alias or ignore entry, the rendered output wraps CustomEngine in the default cross-reference role. @testvalue : float, frame : DataFrame, and items : Sequence[str], confirm that a custom alias map { "DataFrame": "pandas.DataFrame" } and ignore list ["Sequence"] leave the built-in default link on float, replace DataFrame with the alias target, and keep Sequence unlinked in the rendered output. @test@generates
from typing import Mapping, Sequence
def render_param_types(docstring: str, aliases: Mapping[str, str] | None = None, ignore: Sequence[str] | None = None) -> str:
"""Render the parameter and return type tokens from a NumPy-style docstring into reStructuredText, applying cross-reference markup that honors alias and ignore rules while preserving section formatting."""Parses and renders NumPy-style docstrings with cross-reference support.
tessl i tessl/pypi-numpydoc@1.9.0evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9