This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 187
The pre-commit hook fails silently when a pyproject.toml file exists and toml isn't installed #603
Comments
For completeness, here's a MWE:
And here's the output:
|
👍 Had the same issue, thanks for opening this issue because it helped! |
6 tasks
ax3l
added a commit
to ax3l/lasy
that referenced
this issue
Mar 31, 2023
Add [pydocstyle](https://github.com/PyCQA/pydocstyle) to auto-format Function/Class docstrings according to numpy style. Ref.: - http://www.pydocstyle.org - PyCQA/pydocstyle#603
ax3l
added a commit
to ax3l/lasy
that referenced
this issue
Apr 17, 2023
Add [pydocstyle](https://github.com/PyCQA/pydocstyle) to auto-format Function/Class docstrings according to numpy style. Ref.: - http://www.pydocstyle.org - PyCQA/pydocstyle#603
ax3l
added a commit
to ax3l/lasy
that referenced
this issue
Apr 17, 2023
Add [pydocstyle](https://github.com/PyCQA/pydocstyle) to auto-format Function/Class docstrings according to numpy style. Ref.: - http://www.pydocstyle.org - PyCQA/pydocstyle#603
ax3l
added a commit
to ax3l/lasy
that referenced
this issue
Apr 17, 2023
Add [pydocstyle](https://github.com/PyCQA/pydocstyle) to auto-format Function/Class docstrings according to numpy style. Ref.: - http://www.pydocstyle.org - PyCQA/pydocstyle#603
ax3l
added a commit
to ax3l/lasy
that referenced
this issue
Apr 17, 2023
Add [pydocstyle](https://github.com/PyCQA/pydocstyle) to auto-format Function/Class docstrings according to numpy style. Ref.: - http://www.pydocstyle.org - PyCQA/pydocstyle#603
ax3l
added a commit
to ax3l/lasy
that referenced
this issue
Apr 27, 2023
Add [pydocstyle](https://github.com/PyCQA/pydocstyle) to auto-format Function/Class docstrings according to numpy style. Ref.: - http://www.pydocstyle.org - PyCQA/pydocstyle#603
With |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
#534 enabled usage of
pydocstyle
withpyproject.toml
for configuration. In that PR, it was discussed thattoml
shouldn't be a hard dependency for usingpydocstyle
(which I agree with), and that it should simply throw a warning if apyproject.toml
file is detected without thetoml
package present to read it. However, this is problematic when usingpydocstyle
as apre-commit
hook becausepre-commit
will silently consumestdout
unless the hook returns a nonzero exit code.I see a few potential solutions here, which I've placed in order of preference:
additional_dependencies
feature ofpre-commit
to always requiretoml
when installing thepydocstyle
pre-commit
hook. I see the argument for not wanting to error withouttoml
in a general setting, but in the context ofpre-commit
where the dependencies can be tightly managed I think it's OK to have this dependency encoded.pyproject.toml
file (if one exists) to see whether the string[tool.pydocstyle]
is present in the file as a precondition of erroring. This is a bit more engineering effort, but if avoiding requiringtoml
is important enough even in apre-commit
hook then this would be a way to do a more cursory check of the file without parsing it.verbose: True
in thepre-commit
hook definition. This choice has the downside of always makingpydocstyle
noisier, but it at least ensures that the warning will be visible.pydocstyle
fails silently in this case. I personally don't think this is a viable solution, but I listed it in case the project maintainers feel otherwise.I am happy to make a PR if we could come to a consensus on the preferred solution.
The text was updated successfully, but these errors were encountered: