Clean-Py 🧹
CLI tool for automated Python code cleanup and standardization. Formats both .py and .ipynb files using industry-standard tools.
Features
- 🔄 Import optimization (autoflake)
- 📝 Import sorting (isort)
- ✨ Code formatting (black)
- 📓 Notebook cleanup
- Clear cell outputs
- Reset execution counts
- Format code cells
Installation
# Via pip
pip install clean-py
# Or from source
git clone https://github.com/samhardyhey/clean_py
cd clean_py
pip install .
Usage
# 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
Development
Development Workflow
- 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
Project Structure
src/clean_py/- Main package codetests/- Test files
Common Development Commands
See the Makefile for common, useful dev commands.
Credits
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.
Metadata
Release files for clean-py 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| clean_py-1.0.0.tar.gz | 16.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| clean_py-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.6 kB
Release files / clean_py-1.0.0.tar.gz
| Download URL | clean_py-1.0.0.tar.gz |
|---|---|
| Size | 16.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f79195a17a96f8a3229946572d0b6574ada929ca1211da82ba99a4c1c58cc861
|
|
BLAKE2b-256 checksum How to use checksums |
b38cf4951abb1bb2f99bff2448d7161d2bf300873bf3231a49cd38fb611fdbb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.16
|
Release files / clean_py-1.0.0-py3-none-any.whl
| Download URL | clean_py-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2f81a548683ce7c09261abac5632b4b41c9f4b87a3cc56567f34e48563da1cf1
|
|
BLAKE2b-256 checksum How to use checksums |
a8c0ea8ad5cdca973bf0df9923a9997fbafdeba21439aabe58651dc5693e5b1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.16
|