uv: Possibly broken uv lock after upgrading from 0.5.20 to 0.5.21
Hello,
today I’ve upgraded uv from 0.5.20 to 0.5.21 (my OS is Ubuntu 24.04) and I’ve encountered a possible bug. I have a project with dynamic versioning setup in pyproject.toml:
[project]
dynamic = ["version"]
...
[tool.hatch.version]
path = "[path]/__about__.py"
...
I run uv lock which added new line version = "0.2.0" to uv.lock (correctly read from __about__.py):
...
[[package]]
name = [the name of my library]
version = "0.2.0"
...
Next, I run uv lock --locked which I would expect to pass (I’ve just run uv lock), however, I get:
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
So I run uv lock again, but it doesn’t change anything anymore and uv lock --locked keeps failing.
Could you please advice me what I’m doing wrong? Or is this a bug? I think uv lock should not include the version in uv.lock anymore since 0.5.21, as it’s dynamically set, but it seems it does so anyway?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 16 (9 by maintainers)
Commits related to this issue
- Add a test for recursive extras with dynamic metadata (#10792) ## Summary See: https://github.com/astral-sh/uv/issues/10776. — committed to astral-sh/uv by charliermarsh 2 years ago
- Add fallback to build backend when `Requires-Dist` mismatches (#10797) ## Summary This is a smaller alternative to #10794. If the `Requires-Dist` that we extract statically doesn't match the lock... — committed to AmadeusITGroup/uv by charliermarsh 2 years ago
I see the issue. It’s related to the use of recursive extras (the
allextra referencesabcitself; if you remove theallextra, the issue disappears). I should be able to fix it today.Great, thank you! This I can fix. I will take a look.
I tried running
uv cache clean [my package], but that didn’t resolve the issue.Next, I tried running
uv lock --refresh, which no longer includes theversion = "0.2.0"new line touv.lock, however, consequent calluv lock --lockedstill fails.