Skip to content

Instantly share code, notes, and snippets.

@martimors
Last active September 15, 2020 08:25
Show Gist options
  • Save martimors/acd33c5d16105231a3759bed5efbda0f to your computer and use it in GitHub Desktop.
Save martimors/acd33c5d16105231a3759bed5efbda0f to your computer and use it in GitHub Desktop.
Convert all jupyter in path tree to *.py excluting certain directories
# Significantly reduces the size of the repository
# The scripts can be converted back into notebooks, but the cache will be lost
# Excludes the directory ./venv and any directory with a . prefix such as .git
# Converts all jupyter notebooks to python scripts recursively starting from $(pwd)
find . -path ./venv -prune -false -o -name '*.ipynb' | xargs -0 jupyter nbconvert --to script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment