pipx
pipx copied to clipboard
Feature: Add `pipx clean` command
- [X] I have added a news fragment under
changelog.d/(if the patch affects the end users)
Summary of changes
This PR adds a new pipx clean command that allows users to remove pipx data directories. The command provides flexible cleanup options:
Key features
- Selective cleanup: Clean specific components using
--cache,--logs,--trash, or--venvsflags - Full cleanup: Remove all pipx data when no flags are specified (resets to fresh installation state)
- Safety confirmation: Requires user confirmation before cleanup (can be bypassed with
--force)
This PR solves issues #1606 and #1681.
Test plan
Local tests
# Test manual cleanup
pipx install pycowsay
pipx clean --force
pipx list # Verify pycowsay is still installed
# Test selective cleanup
pipx install pycowsay
pipx clean --cache --force
pipx clean --logs --force
pipx clean --trash --force
pipx clean --venvs --force
pipx list # Verify pycowsay is still installed
# Execute unit tests
nox -s tests -- tests/test_clean.py
Unit tests
- Added unit tests in
tests/test_clean.pyto cover various scenarios of thepipx cleancommand, including:- Cleaning individual components (cache, logs, trash, venvs)
- Full cleanup
- Error handling during cleanup
Github Actions CI
I run the workflow tests in my fork to ensure all tests pass in CI.
Link to workflow run: tests #5
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
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