poetry icon indicating copy to clipboard operation
poetry copied to clipboard

pre-commit-update instead of no auto-update at all

Open voxify-dev opened this issue 1 year ago • 3 comments

Issue Kind

Change in current behaviour

Description

As per this issue and docs, it is obvious that we can't use pre-commit autoupdate feature with poetry - but that means manual update every time we want the newest (stable) version of the repo.

Impact

As per description, the impact is very clear - pre-commit config that is not manually updated/revisited will get outdated sooner or later...

Workarounds

I came across a blog post that mentioned this with an alternative solution:

You may notice, I’m also using the third party pre-commit-update tool, since I find it works better than the built in pre-commit autoupdate command. Poetry in particular conflicts with this built-in command.

So I checked out pre-commit-update and it works perfectly for our use case. It is very configurable and you can even use it as a pre-commit hook itself.

Minimal example would be:

repos:
-   repo: https://gitlab.com/vojko.pribudic.foss/pre-commit-update
    rev: v0.5.1post1
    hooks:
    -   id: pre-commit-update
-   repo: https://github.com/python-poetry/poetry
    rev: 1.8.0  # add version here
    hooks:
    -   id: poetry-check
    -   id: poetry-lock
    -   id: poetry-export
    -   id: poetry-install

Which - on commit - would produce:

✘ poetry - 1.8.0 -> 1.8.3
Changes detected and applied

You can even do all sorts of other things - such as excluding the repo, pin it to a certain tag, use unstable versions - etc.

So my proposal would be to perhaps offer that as an alternative in the docs :)

voxify-dev avatar Sep 26 '24 21:09 voxify-dev

Contributions are welcome.

Secrus avatar Sep 26 '24 21:09 Secrus

@Secrus thank you for the fast reply, did not expect and answer this quick :) Do you want me to raise a PR regarding this or you had something else in mind? Thanks!

voxify-dev avatar Sep 26 '24 21:09 voxify-dev

@voxify-dev the fastest way to see docs changes is to submit a PR, so if you are up for it, just make one.

Secrus avatar Sep 26 '24 21:09 Secrus

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.

github-actions[bot] avatar Nov 07 '24 00:11 github-actions[bot]