gh-300: Add uninstall cleanup mode - #390
Merged
Merged
Conversation
Punisheroot
marked this pull request as ready for review
July 31, 2026 15:48
Member
|
Another great PR, much thanks! Just so you're aware, I'm away for a couple of weeks from about now, so you may not get immediate responses (if any) on this repo. But do go check out the main CPython repository and see how you can help there! |
Contributor
Author
|
Thanks, @zooba! If you're heading off on vacation, I hope you have a great time! I'll definitely try to help by closing as many issues here as I can. I'm also trying to contribute over there, I already have two open PRs, and I'm looking forward to contributing even more! |
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
py uninstall --cleanupto remove cached and unrecognized content while preserving every recognized runtime.--yesbypassing the prompt.--cleanupand--purge, and reject combining the two options.Context
PR #389 updated
uninstall --purgeto remove unrecognized content safely. This follow-up implements the less-destructive cleanup mode discussed in #300 for cases where cached or broken content should be removed without uninstalling recognized runtimes.Recognized runtime prefixes are the preservation boundary. Everything else under the configured install and download locations may be removed.
Behavior
py uninstall --cleanupprompts with:If confirmed, the command:
update_all_shortcutsafter cleanup to remove stale registrations and recreate valid ones.Passing
--yesuses the existing confirmation bypass and does not display or read the prompt.Because both cleanup modes operate globally, positional runtime tags are rejected rather than ignored.
--cleanupand--purgeare also mutually exclusive.Tests
Added coverage for:
--cleanup;--yes;--cleanupand--purge;--cleanuptogether with--purge;Existing purge tests now model the actual post-parser state, where
--purgesetscmd.purgeand does not remain in the positionalcmd.argslist.Validation
Performed on Windows with Python 3.14.6:
tests/test_uninstall_command.py tests/test_commands.py: PASS (19 passed);414 passed,1 failed;git diff --check: PASS.The full-suite failure is the unrelated
tests/test_shellext.py::test_RegReadStr: the localHKCU\Environment\PATHvalue isREG_SZ, while that environment-specific test expectsREG_EXPAND_SZ.Compatibility and risk
The new cleanup behavior is opt-in and retains the existing confirmation mechanism. Normal targeted uninstall behavior is unchanged.
Cleanup work is proportional to the configured install and download content it visits. Recognized runtime directories are preserved in full, including when downloads share the same root.
Closes #300