CLI tool for automated Python code cleanup and standardization
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clean_py-1.0.0.tar.gz.
File metadata
- Download URL: clean_py-1.0.0.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f79195a17a96f8a3229946572d0b6574ada929ca1211da82ba99a4c1c58cc861
|
|
| MD5 |
4486c70505b6d6c247e7273506813d7c
|
|
| BLAKE2b-256 |
b38cf4951abb1bb2f99bff2448d7161d2bf300873bf3231a49cd38fb611fdbb6
|
File details
Details for the file clean_py-1.0.0-py3-none-any.whl.
File metadata
- Download URL: clean_py-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f81a548683ce7c09261abac5632b4b41c9f4b87a3cc56567f34e48563da1cf1
|
|
| MD5 |
4bde72a632be877a747373a7f7d2cc57
|
|
| BLAKE2b-256 |
a8c0ea8ad5cdca973bf0df9923a9997fbafdeba21439aabe58651dc5693e5b1b
|