Skip to content

Harmonise formatting: ruff 0.7.4, pyright 1.1.411, line length 88 - #53

Merged
cchlanger merged 3 commits into
mainfrom
cl/harmonise-formatting
Oct 20, 2026
Merged

cchlanger merged 3 commits into
mainfrom
cl/harmonise-formatting

Conversation

@cchlanger

Copy link
Copy Markdown
Member

Summary

Brings gertils in line with the other repositories behind looptrace, as #52 describes. gertils already formats with ruff format, lints with ruff check and type-checks with pyright, in the pre-commit hooks and in CI, and installs neither black, isort, pylint nor mypy. What remained were the versions and the line length, in the first two commits. The third removes # noqa comments that the reformatting showed to be fragile:

Commit Change
ca179bb Pins ruff 0.7.4 and pyright 1.1.411, the versions that looptrace and spotfishing pin. gertils locked ruff 0.3.7 and pyright 1.1.414. gerlichlab/looptrace#557 is where the shared versions are chosen.
2125286 Removes line-length = 100, so that ruff formats at its default of 88, and reformats the code: 8 of 15 files, 114 lines added and 42 removed.
f040948 Tells ruff that numpydoc_decorator's @doc gives functions their docstrings, with pydocstyle's ignore-decorators setting, so that the six # noqa: D103 comments on decorated functions go. When the formatter split a signature, it moved one of them off the line where ruff reports the rule. Classes keep their # noqa: D101, as the setting applies only to functions.

Nothing changes for users of gertils, so this needs no release: besides the layout, the code changes only in its # noqa comments.

Testing

  • With ruff 0.7.4 and pyright 1.1.411, all checks pass before the reformatting, without changes to the code, and pyright --verifytypes gertils still finds 100% of the public API typed.
  • After each commit, all pre-commit hooks and the 122 tests pass.
  • With ignore-decorators, ruff still reports a public function that has neither a docstring nor @doc.
  • 61 lines are still longer than 88 characters: strings, comments and docstrings, which ruff doesn't wrap. As before, the configuration doesn't check line length (E501).

Merging

Please don't squash: main can be fast-forwarded to the branch, which keeps the three commits as they are.

Closes #52

gertils locked ruff 0.3.7, as its constraint allowed any ruff from 0.3,
and pyright 1.1.414. looptrace and spotfishing pin ruff 0.7.4 and
pyright 1.1.411, so that the repositories behind looptrace are
formatted, linted and type-checked by the same versions. gertils now
pins the same versions. Neither version changes any result: all checks
pass without changes to the code.

Refs #52
gertils set a line length of 100, while the other repositories behind
looptrace use the default of 88 of both ruff and black. The setting is
removed, and ruff formats the code at 88. One `# noqa: D103` comment
goes back on the line of its function's name, where ruff reports the
missing docstring, after the formatter split the function's signature.

Strings, comments and docstrings that ruff doesn't wrap stay longer;
the configuration doesn't check line length (E501).

Closes #52
numpydoc_decorator's @doc writes a function's docstring when the module
is imported, so ruff, which only reads the source, reported each
decorated function as undocumented, and each needed a `# noqa: D103`
comment. ruff's pydocstyle setting ignore-decorators now skips the
functions decorated with @doc, and the six comments are removed. ruff
still reports a public function that has neither a docstring nor @doc.
The setting doesn't apply to classes, so their `# noqa: D101` comments
stay.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The tooling updates are consistent, formatting preserves behavior, and no blocking issues were identified.

No open issues 🎉

What changed in this PR

Aligns gertils with the shared formatting and type-checking standards in #52, without changing runtime behavior.

Changes:

  • Pins Ruff 0.7.4 and Pyright 1.1.411.
  • Adopts Ruff’s default 88-character formatting.
  • Replaces function-level docstring suppressions with decorator-aware configuration.
File Description
typings/​zarr/​__init__.pyi Reformats a stub signature.
tests/​test_pixel_value_statistics.py Reformats statistics tests.
tests/​test_pathtools.py Reformats path tests.
tests/​test_get_fov_sort_key.py Reformats imports and tests.
pyproject.toml Pins tools and updates Ruff settings.
poetry.lock Locks the selected tool versions.
gertils/​zarr_tools.py Reformats code and removes a docstring suppression.
gertils/​types.py Reformats exception construction.
gertils/​pixel_value_statistics.py Reformats code and removes docstring suppressions.
gertils/​pathtools.py Reformats code and removes docstring suppressions.

Review effort: Balanced

@cchlanger
cchlanger merged commit f040948 into main Oct 20, 2026
25 checks passed
@cchlanger
cchlanger deleted the cl/harmonise-formatting branch October 20, 2026 14:23
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.

Harmonise formatting and type checking: ruff format, pyright, line length 88

2 participants