Version: 0.2.0
codecleaner is a conservative cleanup tool for development directories. It
removes reproducible dependencies, caches, build artifacts, Python bytecode,
and macOS Mach-O binaries while preserving Git metadata and configured
preserved trees. It can also sanitize a tree for a target operating system and
CPU architecture before or after migration.
Install locally:
python3 -m pip install .Print the version:
codecleaner --versionPreview cleanup:
codecleaner ~/code --dry-runClean:
codecleaner ~/codePreserve directories:
codecleaner ~/code \
--preserve ~/code/floss \
--preserve ~/code/experimentsRemember preserved directories:
codecleaner ~/code \
--preserve ~/code/floss \
--rememberRemembered paths are stored in:
~/.config/codecleaner/config.toml
Concise disk usage stats:
codecleaner ~/code --statsExtended cleanup category stats:
codecleaner ~/code --stats --extendedExplain the reclaimable-space total:
codecleaner ~/code --stats --extended --explain-reclaimableShow every reclaimable item instead of the default bounded list:
codecleaner ~/code --stats --extended --explain-reclaimable --allPrint scanner diagnostics:
codecleaner ~/code --stats --extended --verboseClean every item classified as reclaimable by extended stats:
codecleaner ~/code --clean-reclaimableWalk through reclaimable items interactively:
codecleaner ~/code --clean-reclaimable --interactiveSafely rehearse interactive reclaimable cleanup:
codecleaner ~/code --clean-reclaimable --interactive --dry-runPrepare a tree for a different platform before migration:
codecleaner ~/code \
--sanitize-for linux-amd64 \
--dry-runSanitize a copied tree for the machine running CodeCleaner:
codecleaner ~/code \
--sanitize-for native \
--dry-runnative resolves to the current host platform, such as linux-amd64 or
macos-arm64. Use --sanitize as a shortcut for --sanitize-for native.
Supported initial targets:
linux-amd64
linux-arm64
macos-amd64
macos-arm64
native
Explain the exact sanitization items:
codecleaner ~/code \
--sanitize-for linux-amd64 \
--explain-sanitizationWalk through sanitization candidates interactively:
codecleaner ~/code \
--sanitize-for linux-amd64 \
--interactiveLargest repository/directory census:
codecleaner ~/code --censusInteractive census-based cleanup:
codecleaner ~/code --clean-by-censusDuring interactive cleanup:
y delete
n keep
s skip subtree
q quit
Use --include-preserved with --clean-by-census to allow scanning and
deleting inside preserved directories.
- Symlinks are not followed.
.gitdirectories are preserved during normal cleanup.- Preserved paths are opaque during cleanup.
--stats,--stats --extended, and--censusare read-only.- Mach-O files are detected by magic bytes, not by executable permissions.
Run the test suite:
python3 -m unittest discover -s tests -vBuild and check local distributions:
python3 -m pip install build twine
python3 -m build
python3 -m twine check dist/*Upload to PyPI when ready:
python3 -m twine upload dist/*MIT License - Copyright (c) 2026 Antonio Ognio
Made with ❤️ from 🇵🇪. El Perú es clave 🔑.
