poetry icon indicating copy to clipboard operation
poetry copied to clipboard

Various fixes to pre-commit hooks

Open nzig opened this issue 3 years ago • 7 comments

This PR fixes a few things with the repo's pre-commit hooks:

  • files regex - escape ..
  • Add files to poetry-lock, so that it doesn't run on every commit
  • Remove language_version: python3.
  • Add a hook that runs poetry lock --check

nzig avatar Sep 08 '22 08:09 nzig

@neersighted I'd like to see that backported to 1.2 branch as well, unless you think that only the hook fixes (and not the new hook) should be backported to 1.2. Any opinion?

mkniewallner avatar Sep 23 '22 00:09 mkniewallner

I'm not 100% sure on this just yet -- or rather I'm not sure on the future of pre-commit hooks in this repo given that upstream is incompatible with our release cycle. But I suppose that should not necessarily stop us from improving the hooks in this repo -- it's just that I hesitate to show more support/commitment for them when they may not be viable in the long run.

neersighted avatar Sep 23 '22 01:09 neersighted

I'm not 100% sure on this just yet -- or rather I'm not sure on the future of pre-commit hooks in this repo given that upstream is incompatible with our release cycle. But I suppose that should not necessarily stop us from improving the hooks in this repo -- it's just that I hesitate to show more support/commitment for them when they may not be viable in the long run.

Makes sense. I've removed my review and added status/needs-consensus label to prevent any accidental merge.

Happy to discuss that further if needed.

mkniewallner avatar Sep 23 '22 08:09 mkniewallner

I'm not 100% sure on this just yet -- or rather I'm not sure on the future of pre-commit hooks in this repo given that upstream is incompatible with our release cycle. But I suppose that should not necessarily stop us from improving the hooks in this repo -- it's just that I hesitate to show more support/commitment for them when they may not be viable in the long run.

Could you clarify what you mean by "upstream is incompatible with our release cycle"? You mean that pre-commit hooks are tied to git refs rather than Poetry releases? Or something else I'm misunderstanding?

nzig avatar Sep 28 '22 06:09 nzig

Could you clarify what you mean by "upstream is incompatible with our release cycle"?

I guess @neersighted is talking about the fact, that pre-commit autoupdate does not work for the pre-commit hooks provided in this repo. See the FAQ about this (https://python-poetry.org/docs/pre-commit-hooks/#why-does-pre-commit-autoupdate-not-update-to-the-latest-version) and the linked issues there.

finswimmer avatar Sep 28 '22 06:09 finswimmer

Could you clarify what you mean by "upstream is incompatible with our release cycle"?

I guess @neersighted is talking about the fact, that pre-commit autoupdate does not work for the pre-commit hooks provided in this repo. See the FAQ about this (https://python-poetry.org/docs/pre-commit-hooks/#why-does-pre-commit-autoupdate-not-update-to-the-latest-version) and the linked issues there.

Correct -- we may need to provide pre-commit support through a different repo with a different approach to history.

neersighted avatar Sep 28 '22 13:09 neersighted

I see. Thanks for clarifying.

Prior to this repo having pre-commit hooks defined, I set up https://github.com/medigateio/poetry-pre-commit for doing the same thing internally at my company (also using the 3rd-party poetry-lock-check for getting poetry lock check in 1.1). You could create such a repo with a history like pre-commit expects to get around that problem. I'd be happy to help!

nzig avatar Sep 28 '22 19:09 nzig

Hey @neersighted , what are your thoughts on merging this? It seems the current .pre-commit-hooks.yaml continues to be maintained despite no solution for pre-commit autoupdate, so maybe we could merge this?

I'm also happy to help with setting up a separate repo for the pre-commit hooks to fix the autoupdate issue, if you'd like.

nzig avatar Jul 09 '24 17:07 nzig

Actually, I see that maybe all of the features of this PR were added upstream. The only thing that remains is a hook that runs pre-commit check --lock, but you already have one that runs pre-commit check so it's probably not needed.

I'll close this PR.

nzig avatar Jul 09 '24 18:07 nzig