Skip to content
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

Request: hook to detect unnecessary uv.lock changes #40

Open
jamesbraza opened this issue Jan 22, 2025 · 3 comments
Open

Request: hook to detect unnecessary uv.lock changes #40

jamesbraza opened this issue Jan 22, 2025 · 3 comments

Comments

@jamesbraza
Copy link

I often observe PRs with minor changes to application code or unit tests, but no changes to dependencies, and a uv.lock change is pushed. This uv.lock change is unnecessary, and pollutes the Git history for this uv.lock.

How do we feel about adding a pre-commit hook or GitHub Action to detect uv.lock changes?

I define an unnecessary uv.lock change as something like (I know this isn't exact, but you get the idea):

# Previously, uv.lock has changes on the Git branch `feature`
git checkout feature
git checkout main -- uv.lock
uv lock
if git diff main -- uv.lock; then
    echo "uv.lock change should be reverted."
fi
@zanieb
Copy link
Member

zanieb commented Jan 22, 2025

Wouldn't this deny changes like uv lock --upgrade? This seems a bit weird to enforce.

@zanieb
Copy link
Member

zanieb commented Jan 22, 2025

(I do acknowledge the general problem though — I feel like sometimes my Cargo.lock changes and I don't understand why and need to reset it)

@jamesbraza
Copy link
Author

Wouldn't this deny changes like uv lock --upgrade? This seems a bit weird to enforce.

Yeah you're right, there are cases (like uv lock --upgrade) when one wants to upgrade the lock without changing the underlying dependencies.

A few solutions, both hacks:

  • uv.lock keeping some flag notating if --upgrade or --upgrade-package was involved
  • Filter this check upon the commit message containing the keyword "upgrade" 😆

Anyways, regardless you get it, thanks for responding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants