astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
25.67k stars 749 forks source link

Upgrade tool Python patch versions automatically on managed Python upgrade #7287

Open neutrinoceros opened 1 month ago

neutrinoceros commented 1 month ago

Here's a scenario where I have a tool (say, pre-commit) installed against a uv-managed python interpreter (say 3.12.5) which also happens to be my only uv-managed python 3.12. Trying to upgrade to Python 3.12.6 results in a broken state where Python 3.12.5 is dropped under my tool.

$ uv python install 3.12.5 # important: there must be only point version of 3.12 managed by uv after this command
$ uv tool install pre-commit -p 3.12 --python-preference=only-managed
$ uv tool list
pre-commit v3.8.0
- pre-commit
$ uv python install 3.12 --reinstall
Searching for Python versions matching: Python 3.12
Found existing installation for Python 3.12: cpython-3.12.5-macos-aarch64-none
Installed Python 3.12.6 in 2.44s
 - cpython-3.12.5-macos-aarch64-none
 + cpython-3.12.6-macos-aarch64-none
$ uv tool list
Python interpreter not found at `/Users/clm/Library/Application Support/uv/tools/pre-commit/bin/python3`

I can fix my tools easily enough by manually re-installing 3.12.5 (in co-existence with 3.12.6), but I can see two approaches to improve the user experience here:

zanieb commented 1 month ago

Thanks for the report!

Related:

neutrinoceros commented 1 month ago

Thanks for the pointers. I looked for something similar before I opened this ticket but didn't find #6297. Feel free to close mine as a duplicate if it makes sense !

zanieb commented 1 month ago

I'll tweak the title — we can track this separately, I think, even though it's similar.