Skip to main content

CLI tool for automated Python code cleanup and standardization

Project description

Clean-Py 🧹

License: MIT

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

  1. Create a new branch from dev for your feature/fix
  2. Make your changes and ensure tests pass
  3. Submit a pull request to dev
  4. After review and approval, merge to dev
  5. When ready for release, create a pull request from dev to main

Project Structure

  • src/clean_py/ - Main package code
  • tests/ - 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clean_py-1.0.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

clean_py-1.0.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

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

Hashes for clean_py-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f79195a17a96f8a3229946572d0b6574ada929ca1211da82ba99a4c1c58cc861
MD5 4486c70505b6d6c247e7273506813d7c
BLAKE2b-256 b38cf4951abb1bb2f99bff2448d7161d2bf300873bf3231a49cd38fb611fdbb6

See more details on using hashes here.

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

Hashes for clean_py-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f81a548683ce7c09261abac5632b4b41c9f4b87a3cc56567f34e48563da1cf1
MD5 4bde72a632be877a747373a7f7d2cc57
BLAKE2b-256 a8c0ea8ad5cdca973bf0df9923a9997fbafdeba21439aabe58651dc5693e5b1b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page