Skip to content

Comments

Warn when uv python upgrade tries to install over a non-managed bin installation#14084

Merged
jtfmumm merged 2 commits intofeature/transparent-python-upgradesfrom
jtfm/restore-force-to-upgrade
Jun 18, 2025
Merged

Warn when uv python upgrade tries to install over a non-managed bin installation#14084
jtfmumm merged 2 commits intofeature/transparent-python-upgradesfrom
jtfm/restore-force-to-upgrade

Conversation

@jtfmumm
Copy link
Contributor

@jtfmumm jtfmumm commented Jun 16, 2025

uv python upgrade had originally had a --force option, but we thought it probably didn't make sense. However, switching uv python upgrade behind the preview flag revealed a bad interaction: upgrading a minor version when a non-managed interpreter of that version exists in the bin directory displays an error recommending the use of --force.

This PR only warns if this case arises with uv python upgrade, noting that install --force can be used. It also includes a test for the case described above.

@zanieb
Copy link
Member

zanieb commented Jun 16, 2025

Should we hint / require uv python install --force instead? I worry about the semantics of uv python upgrade --force, it seems less obvious.

Shouldn't uv python upgrade just continue if it encounters a Python in the bin/ it does not manage? Perhaps with a warning?

@jtfmumm jtfmumm force-pushed the feature/transparent-python-upgrades branch 2 times, most recently from eaaba7e to f9f83c6 Compare June 17, 2025 07:26
@jtfmumm jtfmumm added the enhancement New feature or improvement to existing functionality label Jun 17, 2025
@jtfmumm jtfmumm force-pushed the jtfm/restore-force-to-upgrade branch 2 times, most recently from 732b57f to b595b64 Compare June 17, 2025 14:12
@jtfmumm jtfmumm force-pushed the jtfm/restore-force-to-upgrade branch from b595b64 to 2cc1237 Compare June 17, 2025 14:13
@jtfmumm jtfmumm changed the title Restore the --force option for uv python upgrade Warn when uv python upgrade tries to install over a non-managed bin installation Jun 17, 2025
@jtfmumm
Copy link
Contributor Author

jtfmumm commented Jun 17, 2025

Should we hint / require uv python install --force instead? I worry about the semantics of uv python upgrade --force, it seems less obvious.

Shouldn't uv python upgrade just continue if it encounters a Python in the bin/ it does not manage? Perhaps with a warning?

I ended up removing the upgrade --force option. In the test case, upgrade continues with a warning, hinting to use force install if you want to install over the non-managed bin installation.

I've updated the PR title and description.

@jtfmumm jtfmumm requested a review from zanieb June 18, 2025 14:01
@jtfmumm jtfmumm merged commit 3dc1eb2 into feature/transparent-python-upgrades Jun 18, 2025
86 checks passed
@jtfmumm jtfmumm deleted the jtfm/restore-force-to-upgrade branch June 18, 2025 14:39
jtfmumm added a commit that referenced this pull request Jun 18, 2025
…n` installation (#14084)

`uv python upgrade` had originally had a `--force` option, but we
thought it probably didn't make sense. However, switching `uv python
upgrade` behind the preview flag revealed a bad interaction: upgrading a
minor version when a non-managed interpreter of that version exists in
the `bin` directory displays an error recommending the use of `--force`.

This PR only warns if this case arises with `uv python upgrade`, noting
that install `--force` can be used. It also includes a test for the case
described above.
jtfmumm added a commit that referenced this pull request Jun 20, 2025
…n` installation (#14084)

`uv python upgrade` had originally had a `--force` option, but we
thought it probably didn't make sense. However, switching `uv python
upgrade` behind the preview flag revealed a bad interaction: upgrading a
minor version when a non-managed interpreter of that version exists in
the `bin` directory displays an error recommending the use of `--force`.

This PR only warns if this case arises with `uv python upgrade`, noting
that install `--force` can be used. It also includes a test for the case
described above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants