CLI tool for automated Python code cleanup and standardization. Formats both .py and .ipynb files using industry-standard tools.
- 🔄 Import optimization (autoflake)
- 📝 Import sorting (isort)
- ✨ Code formatting (black)
- 📓 Notebook cleanup
- Clear cell outputs
- Reset execution counts
- Format code cells
# Via pip
pip install clean-py
# Or from source
git clone https://github.com/samhardyhey/clean_py
cd clean_py
pip install .# Clean single file
clean_py notebook.ipynb
clean_py script.py
# Clean directory
clean_py path/to/dir
# Selective cleaning
clean_py path/to/dir -py True -isort True -black False -autoflake False- Create a new branch from
devfor your feature/fix - Make your changes and ensure tests pass
- Submit a pull request to
dev - After review and approval, merge to
dev - When ready for release, create a pull request from
devtomain
src/clean_py/- Main package codetests/- Test files
See the Makefile for common, useful dev commands.
This project is a fork of clean_ipynb by Kwat Medetgul-Ernar, with significant modifications and improvements. We gratefully acknowledge the original work that made this project possible.