Stabilize Python upgrades (#17766)

Includes a few things...

- Drops preview warnings for use of `uv python upgrade` and `uv python
install --upgrade`
- Adds `--resolve-links` to `uv python find`, which I needed in test
cases to retain existing snapshots
- Fixes issues in our "Using environment ..." messages on Windows which
were incorrect
- Refactors `from_executable` for the `PythonMinorVersionLink` type
(https://github.com/astral-sh/uv/pull/17842/commits/28b2ed2525327d94fdf5372a29bbbc476d74680f)
to use the type system to prevent incorrect construction (for above)
- Removes special casing where we only upgrade links if they already
exist, which existed so preview wasn't needed on every invocation
- Fixes a bug with `PythonMinorVersionLink::exists` which returned
`true` even if the link pointed to the wrong Python installation leading
to discovery failures
This commit is contained in:
Zanie Blue
2026-02-05 11:26:54 -06:00
parent f3d50129c6
commit d2ab2d0208
35 changed files with 221 additions and 239 deletions
+3 -12
View File
@@ -158,12 +158,9 @@ $ uv python install 3.12.8 # Updates `python3.12` to point to 3.12.8
!!! important
Support for upgrading Python versions is in _preview_. This means the behavior is experimental
and subject to change.
Upgrades are only supported for uv-managed Python versions.
Upgrades are not currently supported for PyPy and GraalPy.
Upgrades are not currently supported for PyPy, GraalPy, and Pyodide.
uv allows transparently upgrading Python versions to the latest patch release, e.g., 3.13.4 to
3.13.5. uv does not allow transparently upgrading across minor Python versions, e.g., 3.12 to 3.13,
@@ -187,14 +184,8 @@ $ uv python upgrade
After an upgrade, uv will prefer the new version, but will retain the existing version as it may
still be used by virtual environments.
If the Python version was installed with the `python-upgrade` [preview feature](./preview.md)
enabled, e.g., `uv python install 3.12 --preview-features python-upgrade`, virtual environments
using the Python version will be automatically upgraded to the new patch version.
!!! note
If the virtual environment was created _before_ opting in to the preview mode, it will not be
included in the automatic upgrades.
Virtual environments using the Python version will be automatically upgraded to the new patch
version.
If a virtual environment was created with an explicitly requested patch version, e.g.,
`uv venv -p 3.10.8`, it will not be transparently upgraded to a new version.