Skip to content

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

@neutrinoceros

Description

@neutrinoceros

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:

  • avoid uninstalling 3.12.5 (maybe raise a warning), seeing that it's used by tools (or at least ask for confirmation)
  • bring all tools installed against 3.12.5 along the ride (this may not be doable in the general case but I confess it was what I expected to happen, but not necessarily silently)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinguv pythonRelated to the uv python interfaceuv toolRelated to the uv tool interface

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions