Skip to content

Clean .py and .ipynb source files using black, isort and autoflake.

License

Notifications You must be signed in to change notification settings

MartijnBogaert/clean-py

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clean Py

Overview

A small CLI program designed to automatically lint .ipynb and .py source code. Tidy and remove redundant imports (via autoflake), sort imports (via isort), lint and format source code in a standardised way (via black). Additionally, clear all .ipynb cell outputs and execution counts. Forked from KwatMe's orginal repo.

Install

Via pip:

pip install clean-py

Or clone directly:

git clone https://github.com/samhardyhey/clean_py
cd clean_py
pip install .

Usage

Clean a single file:

clean_py a_single_notebook.ipynb
clean_py a_single_script.py

Or recurse within a input dir:

clean_py <input_dir>

Clean with specific features if necessary:

clean_py <input_dir> -py True -isort True -black False -autoflake False

Tests

Simple pytesting via:

pytest

Multi-venv tox testing via:

tox

Dist

  • Update version within setup.py
  • Create dist .whl and .tar archives via:
python setup.py sdist bdist_wheel

Push to main pypi repo via:

twine upload dist/*

About

Clean .py and .ipynb source files using black, isort and autoflake.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 86.1%
  • Jupyter Notebook 13.9%