Skip to content

Conversation

@timosachsenberg
Copy link
Contributor

@timosachsenberg timosachsenberg commented Jan 20, 2026

Summary

Enable proper rendering of NumPy and Google-style docstrings in the pyOpenMS documentation.

This is needed to support docstrings like those in the new statistical functions (OpenMS/OpenMS#8524) which use the standard scientific Python docstring format with Parameters, Returns, Examples sections.

Changes

  • Added sphinx.ext.napoleon to the extensions list
  • Added napoleon configuration settings with sensible defaults

Why napoleon?

  • Built into Sphinx - no extra dependency required (available since Sphinx 1.3)
  • Used by pydata-sphinx-theme - the theme we use includes napoleon in their own documentation
  • Scientific Python standard - NumPy-style docstrings are the convention for scientific Python packages

Docstring rendering

Environment Before After
Jupyter / IPython ✅ Works ✅ Works
ReadTheDocs ❌ Raw text with ---- underlines ✅ Properly formatted sections

Example

NumPy-style docstrings like this:

def qvalue(p_values, pi0=1.0, pfdr=False):
    """
    Compute q-values from p-values.

    Parameters
    ----------
    p_values : array-like
        Vector of p-values from hypothesis tests

    Returns
    -------
    ndarray
        Vector of q-values
    """

Will now render with proper "Parameters" and "Returns" sections in the documentation.

Test plan

  • Build docs locally and verify docstrings render correctly
  • Check that existing documentation still renders properly

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Enhanced documentation system to support NumPy and Google-style docstrings for improved API documentation clarity and formatting.

✏️ Tip: You can customize this high-level summary in your review settings.

Enable proper rendering of NumPy and Google-style docstrings in the
pyOpenMS documentation. This is needed to support docstrings like those
in the new statistical functions (PR OpenMS/OpenMS#8524) which use the
standard scientific Python docstring format with Parameters, Returns,
Examples sections.

The napoleon extension is:
- Built into Sphinx (no extra dependency)
- Used by pydata-sphinx-theme's own documentation
- Standard for scientific Python packages (NumPy, SciPy patterns)

Configuration uses sensible defaults that match typical scientific
Python documentation conventions.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 2026

📝 Walkthrough

Walkthrough

Added Sphinx Napoleon extension to docs/source/conf.py to support NumPy and Google style docstring parsing. Configuration includes settings for docstring parsing, parameter/return type handling, and attribute annotation.

Changes

Cohort / File(s) Change Summary
Documentation Configuration
docs/source/conf.py
Added sphinx.ext.napoleon extension to the extensions list with comprehensive Napoleon configuration: enabled NumPy and Google docstring parsing, configured init/private/special member inclusion, parameter/return type annotation settings, and attribute annotation handling. Total: 17 lines added.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

Whiskers twitch with docstring delight,
Napoleon brings NumPy and Google insight,
Configuration crafted with careful care,
Documentation flourishes everywhere! 📚✨🐰

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding the sphinx.ext.napoleon extension to enable NumPy-style docstring support in the documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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