pyclean is a pure Python, cross-platform utility designed to clean up Python bytecode files (.pyc, .pyo) and `__pycache__` directories. Beyond bytecode, it also targets debris generated by popular Python development tools such as cache files, build artifacts, and testing-related data (e.g., from Coverage, Pytest, Ruff, Jupyter, Mypy, Pyright, Tox). It aims to provide a single, consistent command for cleanup across different operating systems, inspired by Debian's original `pyclean` scripts. The current version is 3.6.0, with ongoing active development and recent releases.
pip install pycleanNo compatibility data collected yet for this library.
pyclean is primarily a command-line utility. To clean up bytecode files and `__pycache__` directories in the current directory and its subdirectories, simply run `pyclean .`. You can add `--debris` to also clean up other development tool artifacts. The `--dry-run` option is highly recommended to preview changes before execution.
Before using `--erase`, run `pyclean --erase <target> --dry-run` to review exactly what will be deleted. Be extremely cautious and explicit with paths.
Ensure you are using the `pyclean` installed via pip (or `python -m pyclean`) if you intend to use the features of this cross-platform tool. If targeting Debian package-specific cleanup, use the system-provided `pyclean`.
Install Git on your system if you wish to use the `--git-clean` feature. Refer to your operating system's documentation for Git installation instructions.
No fix needed, this is expected behavior. If performance is critical immediately after a clean, consider running a quick import of your main modules to pre-generate bytecode.
Ensure `pyclean` is installed with `pip install pyclean`. If installed in a virtual environment, activate the environment. You can also try running it explicitly with `python -m pyclean .` to bypass PATH issues.
Always use `pyclean <target> --dry-run --erase` first to confirm what will be removed. Ensure `pyclean` is run with appropriate permissions for the directories it needs to clean (e.g., using `sudo` on Linux/macOS for system-wide directories, or by being the file owner).
Run `pyclean .` in your project's root directory to remove all bytecode and `__pycache__` directories, forcing Python to regenerate fresh bytecode from your current source files.
No dependency data recorded yet.