β β β β β ββββ β β ____
βββ β β β β β β β .'`_ o `;__,
β ββ β β β βββββ ββββ . .'.'` '---' '
β β β β β β β β .`-...-'.'Reclaim disk space by cleaning unused Python environments.
β βββ `-...-'
killpy is a simple tool designed to locate and delete .venv directories from your projects, including virtual environments created by Poetry and Conda. It can help you quickly clean up unnecessary virtual environments and save disk space.
- Automatic search: Finds all .venv directories and any folders containing a pyvenv.cfg file recursively from the current working directory, as they are considered virtual environment folders.
- Support for Conda: Lists all available Conda environments.
- Safe deletion: Lists the directories to be deleted and asks for confirmation.
- Fast and lightweight: Minimal dependencies for quick execution.
To install killpy, use pip:
pip install killpyRun the following command to search for .venv directories and any folders containing a pyvenv.cfg file, as well as to list all Conda environments from the current directory and all its subdirectories recursively:
killpyWith pipx
pipx run killpyWith uvx
uvx killpy- To close the application, press
Ctrl+Q. - To mark a virtual environment for deletion, press
D. - To confirm deletion of marked virtual environments, press
Ctrl+D. - To delete a virtual environment immediately, press
Shift+Delete. - To clean up pycache folders, press
P.
To automatically use KillPy on each commit, you can add a pre-commit hook to your project. This will clean cache directories (like __pycache__) and other unnecessary files before every commit.
- repo: https://github.com/Tlaloc-Es/KillPy
rev: 0.15.4
hooks:
- id: killpy
pass_filenames: false- Delete
__pycache__Files - Remove
distFolders and Build Artifacts - Clean Up Installed Package Cache
- Delete
.egg-infoand.dist-infoFiles - Analyze and Remove Unused Dependencies
- Optimize Disk Space in Python Projects
Contributions are welcome! If you'd like to improve this tool, feel free to fork the repository and submit a pull request.
- Fork the repository
- Create a new branch for your feature:
git checkout -b my-feature - Commit your changes:
git commit -m 'Add my feature' - Push to the branch:
git push origin my-feature - Submit a pull request
This project is licensed under the MIT License. See the LICENSE file for details.
Thank you for using killpy! If you find it useful, please star the repository on GitHub!