Skip to content

Instantly share code, notes, and snippets.

@basnijholt
Created November 26, 2021 16:09
Show Gist options
  • Save basnijholt/af2e6c1f7c313a86b124c191ad9d6c2c to your computer and use it in GitHub Desktop.
Save basnijholt/af2e6c1f7c313a86b124c191ad9d6c2c to your computer and use it in GitHub Desktop.
Clean up and lint a notebook with black, isort, autoflake, pyupgrade
NB=FNAME.ipynb
pip install nbqa autoflake pyupgrade black isort nbconvert jupyter_contrib_nbextensions
nbqa isort $NB
nbqa black $NB
nbqa autoflake -i --remove-all-unused-imports $NB
nbqa pyupgrade $NB --py38-plus
jupyter nbconvert --clear-output --inplace $NB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment