You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a DiracX developer or extension author,
I want the public modules, classes, and functions to carry Google-style docstrings, with CI rejecting missing docstrings and legacy reST tags,
So that the mkdocstrings-generated API reference is complete and the convention adopted in #927 cannot silently regress.
Feature Description
#927 harmonized the existing docstrings to Google style (PR #993) and enabled [tool.ruff.lint.pydocstyle] convention = "google". This follow-up covers what was intentionally left out of that issue's scope:
Write the missing docstrings. The missing-docstring rules D100–D107 are still in the Ruff ignore list (# TODO: Maybe enable these in pyproject.toml). Proposal: enable D100–D103 (missing docstring in module / class / method / function) for src code, and permanently ignore D104 (package __init__.py), D105 (magic methods), D107 (__init__ — the class docstring covers construction) plus all of tests/, as most projects with strict docstring policies do.
Convert the one reST docstring that survived docs: modify rest style comments with doc convert to follow google style. #993: diracx-routers/tests/health/test_probes.py still uses :param:/:return: tags. Ruff doesn't catch it because convention = "google" only disables conflicting pydocstyle checks and does not forbid reST tags.
Guard against reST tags coming back as it will highly likely try to come back as most of the DIRAC docstrings is using reST. Add a pygrep hook to .pre-commit-config.yaml:
- repo: localhooks:
- id: forbid-rest-docstringsname: forbid reST docstring tags (use Google style, see #927)language: pygrepentry: '^\s*:(param|type|returns?|rtype|raises?|ivar|cvar|vartype)\b'types: [python]exclude: ^diracx-client/src/diracx/client/
Bootstrap PR: fix test_probes.py, add the pygrep hook, move the agreed D1xx ignores from the global ignore list into per-file-ignores entries (one per package, plus permanent exemptions for tests).
One PR per package (diracx-db and diracx-core are the big ones), each writing the docstrings and deleting that package's per-file-ignores entry. Note: that could be a good opportunity to give official stacked pull request (public preview since 2026-07-30, gh extension install github/gh-stack) a go!
Definition of Done
test_probes.py docstring converted to Google style
pre-commit hook rejecting reST docstring tags in place
Agreed missing-docstring rules (proposed: D100–D103, src only) no longer globally ignored; all packages pass
API reference on diracx.diracgrid.org renders without undocumented public objects
Alternatives Considered
Ruff DOC rules (pydoclint port): would indirectly flag reST docstrings (their sections don't parse as Google, so args/returns count as undocumented), but the rules are preview-only and the signal is indirect. Can be revisited once stable.
Standalone pydoclint with --style=google: also validates docstring/signature consistency, but adds a second linter overlapping Ruff.
No automated reST guard (rely on review): reST now only enters via copy-paste from legacy DIRAC and is easy to spot — but the 5-line hook automates exactly that review comment.
User Story
As a DiracX developer or extension author,
I want the public modules, classes, and functions to carry Google-style docstrings, with CI rejecting missing docstrings and legacy reST tags,
So that the mkdocstrings-generated API reference is complete and the convention adopted in #927 cannot silently regress.
Feature Description
#927 harmonized the existing docstrings to Google style (PR #993) and enabled
[tool.ruff.lint.pydocstyle] convention = "google". This follow-up covers what was intentionally left out of that issue's scope:Write the missing docstrings. The missing-docstring rules D100–D107 are still in the Ruff
ignorelist (# TODO: Maybe enable theseinpyproject.toml). Proposal: enable D100–D103 (missing docstring in module / class / method / function) forsrccode, and permanently ignore D104 (package__init__.py), D105 (magic methods), D107 (__init__— the class docstring covers construction) plus all oftests/, as most projects with strict docstring policies do.Convert the one reST docstring that survived docs: modify rest style comments with doc convert to follow google style. #993:
diracx-routers/tests/health/test_probes.pystill uses:param:/:return:tags. Ruff doesn't catch it becauseconvention = "google"only disables conflicting pydocstyle checks and does not forbid reST tags.Guard against reST tags coming back as it will highly likely try to come back as most of the DIRAC docstrings is using reST. Add a
pygrephook to.pre-commit-config.yaml:Suggested migration path (following our splitting-PRs workflow, to avoid a repeat of #965):
test_probes.py, add the pygrep hook, move the agreed D1xx ignores from the globalignorelist intoper-file-ignoresentries (one per package, plus permanent exemptions for tests).per-file-ignoresentry. Note: that could be a good opportunity to give official stacked pull request (public preview since 2026-07-30,gh extension install github/gh-stack) a go!Definition of Done
test_probes.pydocstring converted to Google styleAlternatives Considered
DOCrules (pydoclint port): would indirectly flag reST docstrings (their sections don't parse as Google, so args/returns count as undocumented), but the rules are preview-only and the signal is indirect. Can be revisited once stable.--style=google: also validates docstring/signature consistency, but adds a second linter overlapping Ruff.Related Issues
Related to: #927 (this is the follow-up carved out of it)
See also: #993 (conversion + Ruff convention), #965 (closed: scope grew beyond conversion)
Additional Context
No response