Skip to content

docs: improve docstrings configuration#371

Merged
FlorianDeconinck merged 3 commits into
NOAA-GFDL:developfrom
romanc:romanc/docstrings-config
Jan 28, 2026
Merged

docs: improve docstrings configuration#371
FlorianDeconinck merged 3 commits into
NOAA-GFDL:developfrom
romanc:romanc/docstrings-config

Conversation

@romanc
Copy link
Copy Markdown
Collaborator

@romanc romanc commented Jan 28, 2026

Description

This PR is a follow-up from #370 where I've had a look at the auto-generated docs of the NDSL backend. The PR improves the auto-generated docs from docstrings.

The filter, makes sure we hide all methods/constants/attribues starting with at least one underscore. It adds an exception for __init__(...) methods.

show_if_no_docstrings tells the system to show all methods/constants/attributes even if they don't have a docstring attached. This is especially useful for things like enums, where the enum name can be sufficient.

members_order and group_by_category relate to how entries on pages are sorted/grouped. The default is "ungrouped" and in alphabetical order. Imo that leads to weirdly looking pages. This PR suggest to keep the order as in source code and group by category (e.g. constants, classes, ...)

How has this been tested?

Locally running mkdocs serve.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas: N/A
  • I have made corresponding changes to the documentation (e.g. add new modules to docs/docstrings/)
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules: N/A
  • New check tests, if applicable, are included: N/A

This PR improves the auto-generated docs from docstrings.

The filter, makes sure we hide all methods/constants/attribues starting
with at least one underscore. It adds an exception for `__init__(...)`
methods.

`show_if_no_docstrings` tells the system to show all
methods/constants/attributes even if they don't have a docstring
attached. This is especially useful for things like enums, where the
enum name can be sufficient.

`members_order` and `group_by_category` relate to how entries on pages
are sorted/grouped. The default is "ungrouped" and in alphabetical
order. Imo that leads to weirdly looking pages. This PR suggest to keep
the order as in source code and group by category (e.g. constants,
classes, ...)
@romanc romanc changed the title docs: imporve docstrings configuration docs: improve docstrings configuration Jan 28, 2026
Comment thread mkdocs.yml Outdated
options:
filters:
- "!^_"
- "^__init__$"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we get an exception for __call__ as well please? Not that we use it in NDSL too much, but my hunch is that the execution operator should be doc'ed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense, I've added an exception. I started to hide them because in case of the Backend it started to show methods like __add__ and __radd__.

@romanc
Copy link
Copy Markdown
Collaborator Author

romanc commented Jan 28, 2026

Added another commit to cut down on warnings emitted when building the docs. Not perfect yet, but there were some easy things to fix.

Copy link
Copy Markdown
Collaborator

@FlorianDeconinck FlorianDeconinck left a comment

Choose a reason for hiding this comment

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

Thanks!

@FlorianDeconinck FlorianDeconinck added this pull request to the merge queue Jan 28, 2026
Merged via the queue into NOAA-GFDL:develop with commit 14b2777 Jan 28, 2026
6 checks passed
@romanc romanc deleted the romanc/docstrings-config branch January 28, 2026 16:22
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