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

Most upvoted comments

I see the issue. It’s related to the use of recursive extras (the all extra references abc itself; if you remove the all extra, the issue disappears). I should be able to fix it today.

Great, thank you! This I can fix. I will take a look.

Related - #10683?

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 the version = "0.2.0" new line to uv.lock, however, consequent call uv lock --locked still fails.