-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Summary
When attempting to upgrade a tool to a version that has a python version requirement newer than the python version that is installed in the venv, uv aborts with an error, and specifying a python version seems to be the only way to perform the upgrade without doing a complete install.
I would like to see a flag that would determine the required python version and upgrade it in the venv. EG: uv tool upgrade --upgrade-python foo
Example
$ uv tool upgrade dho-tools
error: Failed to upgrade dho-tools
Caused by: Because the current Python version (3.13) does not satisfy Python>=3.14 and dho-tools==0.6.1 depends on Python>=3.14, we can conclude that dho-tools==0.6.1 cannot be used.
And because only dho-tools==0.6.1 is available and you require dho-tools, we can conclude that your requirements are unsatisfiable.
The way out of this is to run uv tool upgrade -p 3.14.3 dho-tools. Even though uv knows what the minimum version is, there is no way to say "yeah, use a compatible python version." The user must be specific about what version to use, which makes scripting these upgrades more difficult.
Reproduction
#!/usr/bin/env bash
set -x
rm -rf uv-test-18083
set -e
mkdir uv-test-18083
cd uv-test-18083
uv init -p 3.13 --package
uv tool install -p 3.13 .
sed -i 's/3.13/3.14/' pyproject.toml # requires GNU sed
uv tool upgrade uv-test-18083To clean up, run uv tool uninstall uv-test-18083
The output is:
$ ./uv-test-18083.sh
+ rm -rf uv-test-18083
+ set -e
+ mkdir uv-test-18083
+ cd uv-test-18083
+ uv init -p 3.13 --package
Initialized project `uv-test-18083`
+ uv tool install -p 3.13 .
Resolved 1 package in 2ms
Built uv-test-18083 @ file:///tmp/tmp.OInvrMGEsn/uv-test-18083
Prepared 1 package in 6ms
Installed 1 package in 1ms
+ uv-test-18083==0.1.0 (from file:///tmp/tmp.OInvrMGEsn/uv-test-18083)
Installed 1 executable: uv-test-18083
+ sed -i s/3.13/3.14/ pyproject.toml
+ uv tool upgrade uv-test-18083
error: Failed to upgrade uv-test-18083
Caused by: Because the current Python version (3.13.5) does not satisfy Python>=3.14 and uv-test-18083==0.1.0 depends on Python>=3.14, we can conclude that uv-test-18083==0.1.0 cannot be used.
And because only uv-test-18083==0.1.0 is available and you require uv-test-18083, we can conclude that your requirements are unsatisfiable.