I often forget to uv sync
after things like tweaking the version number in pyproject.toml
. Then in CI the pipeline
eventually fails as somewhere in setup there’s bound to be uv sync --locked
which then fails as the lock is not in sync.
Luckily using pre-commit is very easy to completely get around this by making it automatically
run uv sync
before push.
First, uv add --dev pre-commit
Then,
default_stages: [pre-commit]
repos: - repo: local hooks: - id: uv-sync name: UV Sync Dependencies entry: uv sync --dev --locked language: system pass_filenames: false stages: [pre-push]
Finally, pre-commit install --hook-type pre-push