pyclean

3.6.0 · active · verified Thu Apr 16

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.

Common errors

Warnings

Install

Quickstart

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.

# Clean up all bytecode in the current directory tree
pyclean .

# Dry-run a cleanup of bytecode and tool debris in verbose mode
# (to see what would be deleted without actually deleting it)
pyclean . --debris --verbose --dry-run

view raw JSON →