Last active
October 12, 2022 08:25
-
-
Save tylerneylon/697065ca5906c185ec6dd3093b237164 to your computer and use it in GitHub Desktop.
git pre-commit hook to help support github-based code reviews of Jupyter notebooks in Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Convert all new Jupyter notebooks to straight Python files for easier code | |
# reviews. | |
# | |
for file in $(git diff --cached --name-only); do | |
if [[ $file == *.ipynb ]]; then | |
jupyter nbconvert --to script $file | |
git add ${file%.*}.py | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment