Skip to content

Latest commit

 

History

History
166 lines (111 loc) · 3.52 KB

File metadata and controls

166 lines (111 loc) · 3.52 KB

PyClear - Python Cache Cleaner 🐍🧹

License: MIT Python Version

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.

Features ✨

  • 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

Installation 📥

Option 1: Pre-built Executables (No Python Required)

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 -y

Option 2: Build Locally (Requires Python 3.7+)

git 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)

Option 3: Install from Source

git clone https://github.com/elfilalihamza/pyclear.git
cd pyclear
pip install .

Usage 🚀

Basic syntax:

pyclear [OPTIONS] [PATH]

Examples:

Clean current directory (with confirmation):

pyclear

Clean specific directory:

pyclear /path/to/your/project

Clean without confirmation prompt:

pyclear -y
# or
pyclear --yes

Clean multiple directories:

pyclear ~/project1 ~/project2 -y

Show help:

pyclear --help

Output Preview 📸

PyClear Demo Example screenshot showing PyClear in action

Build From Source 🔨

Prerequisites

  • Python 3.7+
  • uv (recommended) or pip

Makefile Targets

# Build executable for your current platform
make build-exe

# Clean build artifacts
make clean

Output is placed in dist/ — a single standalone executable.

Cross-Platform Releases (GitHub Actions)

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.0

Check build progress in the Actions tab on GitHub.

Local Testing with act

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-latest

Note: Due to Docker limitations, act can only test one platform at a time locally. Real GitHub Actions builds all 3 in parallel without issues.

Acknowledgements 🙏

  • Rich - For beautiful/simple terminal formatting
  • PyInstaller - For creating standalone executables
  • Python community for inspiration