-
Notifications
You must be signed in to change notification settings - Fork 502
Feature: Add pipx clean command
#1683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The new command supports selective cleanup with `--cache`, `--logs`, `--trash`, and `--venvs` flags to remove specific components. Running `pipx clean` without flags performs a full cleanup, removing all pipx data and resetting to a fresh installation state.
Configured mypy to recognize pytest library by adding pytest plugin to mypy configuration. This allows mypy to properly type-check pytest fixtures and decorators, eliminating the need for "type: ignore" comments in test files.
13bc7cf to
f713984
Compare
|
Hi maintainers, just checking in to see if there’s any update on this PR. Please let me know if I missed something or if any changes are needed |
dukecat0
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the test, could you change the style of it so it is consistent with our other existing tests?
Yeah, sure I will adapt them |
for more information, see https://pre-commit.ci
dukecat0
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few more comments :D
|
|
||
| # Execute all operations and combine exit codes | ||
| for operation in cleanup_operations: | ||
| result: ExitCode = operation(verbose) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is ExitCode required by linter?
| assert " Path: " in captured.out | ||
| assert "Removing pycowsay..." in captured.out | ||
| assert "Removing 1 installed package(s)..." in captured.out | ||
| assert "All installed packages removed." in captured.out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add a test for user input here? (y/N)
https://stackoverflow.com/questions/35851323/how-to-test-a-function-with-input-call/36377194#36377194
| force: Skip confirmation prompt | ||
| """ | ||
| print(f"{hazard} {red('WARNING')}: This will remove ALL pipx data!") | ||
| print(red("All installed packages will be lost.")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the perspective of user, I think these messages should be displayed before the y/N prompt?
| action="store_true", | ||
| help="Skip confirmation prompts (use with caution!)", | ||
| ) | ||
| p.set_defaults(subparser=p) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used anywhere else?
changelog.d/(if the patch affects the end users)Summary of changes
This PR adds a new
pipx cleancommand that allows users to remove pipx data directories. The command provides flexible cleanup options:Key features
--cache,--logs,--trash, or--venvsflags--force)This PR solves issues #1606 and #1681.
Test plan
Local tests
Unit tests
tests/test_clean.pyto cover various scenarios of thepipx cleancommand, including:Github Actions CI
I run the workflow
testsin my fork to ensure all tests pass in CI.Link to workflow run: tests #5