-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Support pre-commit hooks even if poetry related files are missing #6944
Comments
Submit a pull request! |
It looks like just poetry-lock is missing a files pattern which is intentional. However, pre-commit has a very customisable method for enabling hooks, as you can overwrite any property you'd like. If you'd like to only have poetry lock when pyproject.toml or poetry.lock is changed, you can use the following configuration: - repo: https://github.com/python-poetry/poetry
rev: '1.2.2'
hooks:
- id: poetry-lock
files: '^pyproject.toml$|^poetry.lock$' This will only run poetry-lock on changes to pyproject.toml or poetry.lock |
@onerandomusername quick question: I was browsing the Poetry issues because I recently needed to add the same The only changes I see this command making if neither the lock nor the toml files change is when a dependency gets updated, which means that we can unintentionally introduce changes to the lock file. I don't think that's a good default, and I see a similar discussion happening in this issue where it's about only introducing changes when the user explicitly asks for it. I'd like to propose adding the Note: I recognize this is potentially not the same topic for this issue, so happy to create a new one, but this was the most relevant comment I ran across, hence why I wanted to ask 😄 |
I'm not a maintainer or involved with poetry development, but I agree that |
@onerandomusername I understand. Thanks for the feedback never the less 😄 will file a separate bug for this and share it here. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Feature Request
Pre-commit is excellent for standardizing checks across an organization's repositories. Other pre-commits use conditionals to
SKIP
checks if they are unnecessary. Poetry's pre-commits, however, will fail if pyproject.toml/poetry.lock dont exist in a repo,Current behavior
pre-commits for poetry fail if poetry related files are missing
Ideal behavior
pre-commits for poetry
SKIP
gracefully if poetry related files are missingBut why?
So
.pre-commit-config.yaml
files can be consistent across all repos for an organization.The text was updated successfully, but these errors were encountered: