Skip to content

Instantly share code, notes, and snippets.

@habi
Last active September 11, 2024 06:47
Show Gist options
  • Save habi/27db69df1b79b7563b53e06f12018573 to your computer and use it in GitHub Desktop.
Save habi/27db69df1b79b7563b53e06f12018573 to your computer and use it in GitHub Desktop.
`pycodestyle` all Jupyter notebooks in a folder
for i in *.ipynb
# Tell us what we are doing
do echo Checking $i
# Convert the Jupyter notebook to .py and run through pycodestyle
jupyter nbconvert $i --to script && pycodestyle *.py --ignore=E501,E402,W391,W503 --show-source;
# Remove the converted file, thanks to https://stackoverflow.com/a/12152997
echo Removing "${i%.*}.py"
rm "${i%.*}.py"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment