Add --outdated to uv python uninstall and --uninstall to uv python upgrade#18770
Open
MoonMao42 wants to merge 2 commits intoastral-sh:mainfrom
Open
Add --outdated to uv python uninstall and --uninstall to uv python upgrade#18770MoonMao42 wants to merge 2 commits intoastral-sh:mainfrom
--outdated to uv python uninstall and --uninstall to uv python upgrade#18770MoonMao42 wants to merge 2 commits intoastral-sh:mainfrom
Conversation
b8d7bc7 to
26f4209
Compare
Rebased from astral-sh#16018 by @yumeminami with review changes from @zanieb. Adds `--outdated` to `uv python uninstall` to remove old patch versions while keeping the latest for each minor version. Supports filtering by target (e.g., `uv python uninstall 3.12 --outdated`) and ignores the flag when a specific patch version is requested.
After upgrading Python to the latest patch version, `--uninstall` removes old patch versions from the same minor-version group. Groups are scoped by implementation, major.minor, platform, and variant so freethreaded and standard builds are cleaned independently. Cleanup runs after all upgrades complete and only affects groups that were actually upgraded in the current invocation. Deletion failures are logged as warnings and do not affect the exit code.
26f4209 to
f0aa731
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rebase of #16018 (by @yumeminami, with review changes from @zanieb) onto current main, plus
uv python upgrade --uninstallper @konstin's suggestion in #15805.Two ways to clean up old Python patch versions:
uv python uninstall --outdated— remove old patches standaloneuv python upgrade --uninstall— remove old patches after upgradingCloses #15805.
Test Plan
python_uninstall_outdated: multiple minor versions,--outdatedkeeps only latest patch eachpython_uninstall_outdated_with_target:--outdated 3.12scoped to one minorpython_upgrade_with_uninstall: install 3.12.6 → upgrade 3.12 --uninstall → 3.12.6 gone