-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: Add numpydoc pre-commit hook #1371
Conversation
Replaced '(\s*)"""(.*)([^"])$' with '$1"""\n$1$2$3' using repgrep
67c5292
to
96045fb
Compare
Surprised that it isn't already effective/covered by the
Do you know why? |
It kind of is, but not completely; see the failed CI run for examples of things that aren't checked by ruff. There is an open issue in ruff to cover all of numpydoc: astral-sh/ruff#8425. See also:
|
Personally I don't think that it's worth the trouble right now. |
"ES01", # No "extended summary" section | ||
"EX01", # No "Examples" section | ||
"SA01", # No "See also" section | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have those filters in scikit-learn: https://github.com/scikit-learn/scikit-learn/blob/fef620292973dd25ca206c8bbdff194771c857fc/sklearn/tests/test_docstrings.py#L45
"ES01", # No "extended summary" section | ||
"EX01", # No "Examples" section | ||
"SA01", # No "See also" section |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those one are quite important for a nice documentation actually.
Right now apart from the long summary, examples and see also that find important to have, we only have 3 failures with the rendering of the In terms of rule, we have set that we skip in scikit-learn because numpydoc is picky a bit too much on something that does not necessarily improve the documentation. Regarding the "necessity", I think that we should pretty soon have a user guide and have proper docstring. Otherwise, it is already a project smell when you don't have a clear documentation explaining with words why a project is useful (a getting_started is not enough). So I would think that we should still fix those issues on the way and not only postpone them releases after releases. |
Update with different settings. If we don't ignore "extended summary", "example" or "see also", but we do ignore "summary should be on a different line", we get ~2000 lints. Most of them are superfluous IMO. Yeah the fine-grained approach that sklearn uses sounds like a good start because we can spread out the change over time, so that we don't have to keep a PR open while we fix 2000 errors. |
Is it that we get warning on function that are not part of the public API? The code in scikit-learn, is actually reducing this behaviour for the public code base and I would argue that it is indeed enough. |
Yes that's right. I don't know what regex to give to numpydoc to filter things correctly (e.g |
Yep so it is indeed more involved work than just having the linter on. So we might delay that. We just need to ensure that we keep documenting as good as possible in the meantime ;) |
What we could also do is start enforcing rules in CI only on changed files, so for a while every PR would include a bit of docs improvement |
skore/src
are checkedCloses #1338