Skip to content

uv version leaves lock file out-of-date #13254

Closed
@StephenRobin

Description

@StephenRobin

Summary

Thanks for adding the uv version command! I'm not sure if this is a bug or not, but it feels strange that the version number in uv.lock is not updated by uv version.

We currently have a dynamic version number in pyproject.toml. In the CI pipeline we set the version of the build in an env var, then do:

uv sync --locked # locked to ensure the build is reproduceable and pyproject.toml matches uv.lock
uv run --no-sync ruff check
# Some other stuff
uv build
# Some other stuff

I would like to change this so we just set the version number in pyproject.toml at the start of the CI run using uv version 1.2.3. This doesn't work as the subsequent uv sync --locked step gives the error "The lockfile at uv.lock needs to be updated, but --locked was provided. To update the lockfile, run uv lock".

The error makes sense, but wouldn't it be better to either update the lock file as part of uv version or perhaps even omit the version from uv.lock like when dynamic versions are used?

I could solve this by doing uv version 1.2.3 && uv lock after the sync (some of our later stages require it to be locked) but it feels wrong.

Platform

Ubuntu 22

Version

uv 0.7.2

Python version

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions