Closed brian-rose closed 1 year ago
👋 Thanks for opening this PR! The Cookbook will be automatically built with GitHub Actions. To see the status of your deployment, click below. 🔍 Git commit SHA: a894b9deab788488a705bf991008caed51200782 ✅ Deployment Preview URL: https://ProjectPythia.github.io/cookbook-template/_preview/117
Success! Because failure!
The build log now reports back the notebook exception and reports failure:
nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
[50](https://github.com/ProjectPythia/cookbook-template/actions/runs/5257020548/jobs/9499191609?pr=117#step:17:51)
------------------
[51](https://github.com/ProjectPythia/cookbook-template/actions/runs/5257020548/jobs/9499191609?pr=117#step:17:52)
# THIS IS JUST FOR TESTING -- should raise exception
[52](https://github.com/ProjectPythia/cookbook-template/actions/runs/5257020548/jobs/9499191609?pr=117#step:17:53)
print(bob)
[53](https://github.com/ProjectPythia/cookbook-template/actions/runs/5257020548/jobs/9499191609?pr=117#step:17:54)
------------------
[54](https://github.com/ProjectPythia/cookbook-template/actions/runs/5257020548/jobs/9499191609?pr=117#step:17:55)
[55](https://github.com/ProjectPythia/cookbook-template/actions/runs/5257020548/jobs/9499191609?pr=117#step:17:56)
[56](https://github.com/ProjectPythia/cookbook-template/actions/runs/5257020548/jobs/9499191609?pr=117#step:17:57)
---------------------------------------------------------------------------
[57](https://github.com/ProjectPythia/cookbook-template/actions/runs/5257020548/jobs/9499191609?pr=117#step:17:58)
NameError Traceback (most recent call last)
[58](https://github.com/ProjectPythia/cookbook-template/actions/runs/5257020548/jobs/9499191609?pr=117#step:17:59)
Cell In[1], line 2
[59](https://github.com/ProjectPythia/cookbook-template/actions/runs/5257020548/jobs/9499191609?pr=117#step:17:60)
1 # THIS IS JUST FOR TESTING -- should raise exception
[60](https://github.com/ProjectPythia/cookbook-template/actions/runs/5257020548/jobs/9499191609?pr=117#step:17:61)
----> 2 print(bob)
[61](https://github.com/ProjectPythia/cookbook-template/actions/runs/5257020548/jobs/9499191609?pr=117#step:17:62)
[62](https://github.com/ProjectPythia/cookbook-template/actions/runs/5257020548/jobs/9499191609?pr=117#step:17:63)
NameError: name 'bob' is not defined
[63](https://github.com/ProjectPythia/cookbook-template/actions/runs/5257020548/jobs/9499191609?pr=117#step:17:64)
[64](https://github.com/ProjectPythia/cookbook-template/actions/runs/5257020548/jobs/9499191609?pr=117#step:17:65)
I removed the broken test code, so this is ready to merge into the template.
Test to try to address the problem identified in https://github.com/ProjectPythia/gridding-cookbook/issues/16: that errors in notebooks should raise errors in the book build.
There is a relevant flag in myst-nb called
nb_execution_raise_on_error
. Currently it's not exposed directly through jupyter-book (https://github.com/executablebooks/jupyter-book/issues/2011) but I think we can set it anyway through the section in the config filewhere we can set arbitrary sphinx options.
I put a deliberate error into the template notebook here to see if it triggers a failure.