Download a non-executed notebook #1829
-
Hi! When using the download "ipynb" button on a book, it downloads an executed version of the notebook from the html I wonder if there was a time where JB would download from the github repository, which then gave me control of striping the output of the notebook before pushing to the repo. From a teaching perspective, I think it would be to have empty notebooks for students when they download them for classes. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey @fmaussion There are a few ways to strip the output of a Jupyther Notebook using Github. First of all you could use Pre-commit Hooks to Strip the output. |
Beta Was this translation helpful? Give feedback.
-
Hey @fmaussion thank you for marking my response as the answer. I'm really glad i helped you resolve the issue. The combination of Jupyter-book clean --html book and find . - name '*.ipynb' -exec nbstripout {} will make sure the metadata is stripped out and make version control much smoother |
Beta Was this translation helpful? Give feedback.
Hey @fmaussion There are a few ways to strip the output of a Jupyther Notebook using Github. First of all you could use Pre-commit Hooks to Strip the output.
This can be archived using the nbstripout library. You'll find this library and it;s documentation at the following link https://pypi.org/project/nbstripout/0.2.3/
and you can install it using the following command
pip install nbstripout
Secondly you can manually strip the output befor building the File. You can use the following commands to complete this task
nbstripout .ipynb
jupyter-book build
Finally if you want to automate this you could use or build a custom script created for this purpose. Here's a link a script previously cre…