docs: convert public-API docstrings to NumPy style + enforce convention#856
Merged
Conversation
Convert all Google-style (`Args:`/`Returns:`) and broken-RST
(`Parameters::`/`Returns::`/`:param:`) docstrings of public APIs to
NumPy-doc style across 142 modules. Reformat the shared parameter
fragments in `brainpy/dyn/_docs.py` and align their `%s`/`{}` injection
indentation (lif.py, base.py) so napoleon parses every injected
`Parameters` section correctly.
Config:
- docs/conf.py: pin napoleon to NumPy style (google off, numpy on, plus
use_param/use_rtype/preprocess_types).
- pyproject.toml: record `[tool.pydocstyle] convention = "numpy"` as the
single source of truth for the docstring convention.
Format-only change: with docstrings stripped, the AST of every one of the
141 touched source modules is byte-identical to before. napoleon parses
all 1256 public `Parameters` sections with zero errors and zero empty
sections.
There was a problem hiding this comment.
Sorry @chaoming0625, your pull request is larger than the review limit of 150000 diff characters
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Standardize BrainPy's public-API docstrings on NumPy-doc style (per
CLAUDE.md) and configure the toolchain to enforce it.Args:/Returns:/Raises:) and broken-RST (Parameters::/Returns::/:param:) docstrings of public APIs to NumPy style across 142 modules.brainpy/dyn/_docs.pyand align their%s/{}injection indentation (lif.py,base.py) so napoleon parses every injectedParameterssection correctly.Config
docs/conf.py: pin napoleon to NumPy style (napoleon_google_docstring=False,napoleon_numpy_docstring=True, plususe_param/use_rtype/preprocess_types).pyproject.toml: record[tool.pydocstyle] convention = "numpy"as the single source of truth for the convention.Safety / verification
_docs.pystring-constant values anddocs/conf.pyconfig).import brainpysucceeds; public attribute access works.Parameterssections — 0 parse errors, 0 empty sections.Args:/::-style /:param/ single-colon section markers in non-test code.