PyClear is a command-line tool that removes all __pycache__ directories recursively from a specified directory. It's designed to help Python developers clean up bytecode cache files that can accumulate during development and cause conflicts.
- Recursively removes all
__pycache__directories - Interactive confirmation prompt for safety
- Rich terminal interface with color-coded feedback
- Works on Linux, macOS, and Windows
- No dependencies required for standalone version
- Fast and efficient directory scanning
Download the latest release for your OS from the Releases page:
- Windows:
pyclear-windows.exe - macOS:
pyclear-macos - Linux:
pyclear-linux
Setup:
Windows:
# Just run it directly
pyclear-windows.exe --pycache --pytest -y
# Or add to PATH for convenience
setx PATH "%PATH%;C:\path\to\pyclear"macOS / Linux:
chmod +x pyclear-macos # or pyclear-linux
sudo mv pyclear-macos /usr/local/bin/pyclear
pyclear --pycache -ygit clone https://github.com/elfilalihamza/pyclear.git
cd pyclear
# Install dependencies
pip install uv
uv sync
# Build executable
make build-exe
# Output: dist/pyclear.exe (Windows) or dist/pyclear (Linux/macOS)git clone https://github.com/elfilalihamza/pyclear.git
cd pyclear
pip install .Basic syntax:
pyclear [OPTIONS] [PATH]Clean current directory (with confirmation):
pyclearClean specific directory:
pyclear /path/to/your/projectClean without confirmation prompt:
pyclear -y
# or
pyclear --yesClean multiple directories:
pyclear ~/project1 ~/project2 -yShow help:
pyclear --help
- Python 3.7+
- uv (recommended) or pip
# Build executable for your current platform
make build-exe
# Clean build artifacts
make cleanOutput is placed in dist/ — a single standalone executable.
When you push a git tag (e.g., v1.0.0), GitHub Actions automatically builds executables for Windows, macOS, and Linux and attaches them to the release:
# Create a release
git tag v1.0.0
git push origin v1.0.0Check build progress in the Actions tab on GitHub.
Test the CI/CD workflow locally using act:
# Install act (Windows)
winget install nektos.act
# Test a single platform
act workflow_dispatch -j build --matrix os:ubuntu-latestNote: Due to Docker limitations,
actcan only test one platform at a time locally. Real GitHub Actions builds all 3 in parallel without issues.
- Rich - For beautiful/simple terminal formatting
- PyInstaller - For creating standalone executables
- Python community for inspiration