SIGN IN SIGN UP

[MNT-style]: Add ruff pydocstyle for Google-style docstrings (#1918)

* Configure ruff pydocstyle for Google docstrings

Enables ruff's pydocstyle plugin with Google convention to lint
docstrings as part of make format-check / make lint.

Selects only the seven safely-auto-fixable D rules so the diff in the
follow-up normalization commit is purely tool-generated,
D202, D209, D212, D214, D410, D411, D412.

Mirrors pyproject.toml's mypy excludes for explicitly deprecated paths
(lightly/active_learning, six deprecated models, five deprecated
model tests) into [tool.ruff.lint.per-file-ignores]. The other,
provisionally-untyped files in the mypy excludes are not mirrored,
the seven selected D rules are all auto-fixable, so they impose no
manual effort and can absorb the auto-fixes painlessly.

Drops --select I from the pre-commit ruff hook so the new D rules
also trigger locally.

Enables docstring-code-format = true so ruff format normalizes code
blocks inside docstrings.

* Normalize docstring formatting with ruff

Pure tool output from the configuration enabled in the previous commit
(ruff check --fix and ruff format, no manual edits).
This commit will be appended to .git-blame-ignore-revs
in the next commit so git blame skips it.

* Add docstring normalization commit to .git-blame-ignore-revs

* Fix docstring formatting issues raised in review

1. Non-python content in REPL (>>>) blocks was being parsed as Python
by the formatter. Replaced with reST code blocks or inline literals.

2. Comments inside example if/else bodies and standalone comment
lines caused awkward formatter output. Added pass with inline
comments where if/else bodies were empty, and moved standalone
comments behind the relevant code line.

3. Docstrings starting directly with Args: now have a one-line
summary following Google docstring convention.

---------

Co-authored-by: Lionel Peer <lionel@lightly.ai>
N
Nirbhai committed
335a02e53bef802e53e888c21a3dd29d3f0eabf0
Parent: e84975a
Committed by GitHub <noreply@github.com> on 5/12/2026, 8:43:15 AM