-
Notifications
You must be signed in to change notification settings - Fork 2.9k
uv lock empties lockfile when upgrading python #13951
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
I noticed this while migrating a project to uv and testing that the pinned version of python can be updated with renovate. If I have project with a dependency which adds some resolution-markers to uv.lock, update the pinned version of python, and run uv lock --upgrade-package python, all of the packages in uv.lock are removed.
Steps to reproduce (in above repo):
- Increment the
requires-python = "==3.11.12"constraint in pyproject.toml to"==3.11.13" - Run
uv lock --upgrade-package python(this is the command run by renovate) - Lockfile is emptied
I'm not sure whether this is:
- A bug in uv?
- Renovate doing something unsupported (i.e. should I be reporting this to renovate instead)?
- An issue with the build configuration of this particular opencv package?
- Me doing it wrong by pinning an exact version of python instead of a range?
Some other notes:
- uv version is 0.7.12
- Reproduces on macos 15.5 (arm64) environment, github actions' "ubuntu-latest" environment, and whatever environment the hosted renovate bot uses
- It only seems to happen if the project has a dependency which causes uv.lock to contain
resolution-markers - Bumping requires-python and running
uv lockwithout the--upgrade-packageargument produces the correct results - Using an inexact constraint like
requires-python = ">=3.11.12,<3.12"and bumping it to">3.11.13,<3.12"also behaves correctly - It doesn't seem related to the particular version of python. e.g., upgrading from 3.13.3 to 3.13.4 exhibits the same behavior.
Verbose output:
$ cat uv.lock
version = 1
revision = 2
requires-python = "==3.11.12"
resolution-markers = [
"sys_platform == 'darwin'",
"platform_machine == 'aarch64' and sys_platform == 'linux'",
"(platform_machine != 'aarch64' and sys_platform == 'linux') or (sys_platform != 'darwin' and sys_platform != 'linux')",
]
[[package]]
name = "numpy"
...
$ uv run python --version
Python 3.11.12
$ uv lock --upgrade-package python --verbose
DEBUG uv 0.7.12 (Homebrew 2025-06-06)
DEBUG Found workspace root: `/Users/nparker/Projects/renovate-bug-repro`
DEBUG Adding root workspace member: `/Users/nparker/Projects/renovate-bug-repro`
DEBUG No Python version file found in workspace: /Users/nparker/Projects/renovate-bug-repro
DEBUG Using Python request `==3.11.13` from `requires-python` metadata
DEBUG Checking for Python environment at `.venv`
DEBUG The project environment's Python version does not satisfy the request: `Python ==3.11.13`
DEBUG Searching for Python ==3.11.13 in managed installations or search path
DEBUG Searching for managed installations at `/Users/nparker/.local/share/uv/python`
DEBUG Skipping incompatible managed installation `cpython-3.13.4-macos-aarch64-none`
DEBUG Found managed installation `cpython-3.11.13-macos-aarch64-none`
DEBUG Found `cpython-3.11.13-macos-aarch64-none` at `/Users/nparker/.local/share/uv/python/cpython-3.11.13-macos-aarch64-none/bin/python3.11` (managed installations)
Using CPython 3.11.13
DEBUG Using request timeout of 30s
DEBUG Ignoring existing lockfile due to `--upgrade-package`
DEBUG Found static `pyproject.toml` for: renovate-bug-repro @ file:///Users/nparker/Projects/renovate-bug-repro
DEBUG No workspace root found, using project root
DEBUG Solving with installed Python version: 3.11.13
DEBUG Solving with target Python version: ==3.11.13
DEBUG Narrowed `requires-python` bound to: <=3.11.12, >=3.11.13
DEBUG Narrowed `requires-python` bound to: <=3.11.12, >=3.11.13
DEBUG Narrowed `requires-python` bound to: <=3.11.12, >=3.11.13
DEBUG Solving split (python_full_version == '3.11.12' and sys_platform == 'darwin') (requires-python: RequiresPython { specifiers: VersionSpecifiers([VersionSpecifier { operator: LessThanEqual, version: "3.11.12" }, VersionSpecifier { operator: GreaterThanEqual, version: "3.11.13" }]), range: RequiresPythonRange(LowerBound(Included("3.11.13")), UpperBound(Included("3.11.12"))) })
DEBUG Tried 0 versions:
DEBUG split `python_full_version == '3.11.12' and sys_platform == 'darwin'` resolution took 0.001s
DEBUG Solving split (python_full_version == '3.11.12' and platform_machine == 'aarch64' and sys_platform == 'linux') (requires-python: RequiresPython { specifiers: VersionSpecifiers([VersionSpecifier { operator: LessThanEqual, version: "3.11.12" }, VersionSpecifier { operator: GreaterThanEqual, version: "3.11.13" }]), range: RequiresPythonRange(LowerBound(Included("3.11.13")), UpperBound(Included("3.11.12"))) })
DEBUG Tried 0 versions:
DEBUG split `python_full_version == '3.11.12' and platform_machine == 'aarch64' and sys_platform == 'linux'` resolution took 0.000s
DEBUG Solving split ((python_full_version == '3.11.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.12' and sys_platform != 'darwin' and sys_platform != 'linux')) (requires-python: RequiresPython { specifiers: VersionSpecifiers([VersionSpecifier { operator: LessThanEqual, version: "3.11.12" }, VersionSpecifier { operator: GreaterThanEqual, version: "3.11.13" }]), range: RequiresPythonRange(LowerBound(Included("3.11.13")), UpperBound(Included("3.11.12"))) })
DEBUG Tried 0 versions:
DEBUG split `(python_full_version == '3.11.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.12' and sys_platform != 'darwin' and sys_platform != 'linux')` resolution took 0.000s
INFO Solved your requirements for 3 environments
DEBUG Distinct solution for split (python_full_version == '3.11.12' and sys_platform == 'darwin') with 0 packages
DEBUG Distinct solution for split (python_full_version == '3.11.12' and platform_machine == 'aarch64' and sys_platform == 'linux') with 0 packages
DEBUG Distinct solution for split ((python_full_version == '3.11.12' and platform_machine != 'aarch64' and sys_platform == 'linux') or (python_full_version == '3.11.12' and sys_platform != 'darwin' and sys_platform != 'linux')) with 0 packages
Resolved in 9ms
Removed numpy v2.3.0
Removed opencv-python-headless v4.11.0.86
Removed renovate-bug-repro v0.1.0
$ cat uv.lock
version = 1
revision = 2
requires-python = "==3.11.13"
resolution-markers = [
"python_version < '0'",
]
Platform
Darwin 24.5.0 arm64
Version
uv 0.7.12 (Homebrew 2025-06-06)
Python version
Python 3.11.12
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working