Pure Python cross-platform pyclean. Clean up your Python bytecode.
copied from cf-post-staging / pycleanWorried about .pyc files and __pycache__ directories? Fear not!
PyClean is here to help. Finally the single-command clean up for Python
bytecode files in your favorite directories. On any platform.
pyclean .
pyclean . --dry-run --verbose
pyclean --help
PyClean can clean up leftovers, generated data and temporary files from popular Python development tools in their default locations, along with Python bytecode. The following topics are currently covered:
pyclean . --debris
pyclean . --debris all
pyclean . -d jupyter -n -v
PyClean also lets you remove free-form targets using globbing. Note that
this is potentially dangerous: You can delete everything anywhere in the
file system, including the entire project you’re working on. For this
reason, the --erase option has a few artificial constraints:
--yes option, in addition.pyclean . --erase tmp/**/* tmp/
PyClean can safely detect and remove empty directories that are left in your project after refactoring code.
pyclean . --folders --verbose
PyClean integrates with Git's git clean command to remove untracked
files from version-controlled directories. The --git-clean (or -g)
flag runs after all other cleanup operations.
By default, Git prompts interactively to confirm which files to delete.
Use --dry-run to preview, or --yes to force deletion without
prompts. The --ignore patterns are honored as exclusions.
pyclean . --debris all --git-clean --dry-run
pyclean . --ignore .idea .vscode --git-clean --yes
Note: Git must be installed for this feature. If a directory is not under version control, a warning is logged and pyclean continues.