Render document even on CellExecutionError (code exception) #12623
-
DescriptionJupyter notebooks can be run and be useful even when in a broken state. This helps development and debugging. One issue with using qmd files solely is that quarto refuses to render them unless all of the code cells run cleanly. This can be challenging to debug long scripts that suddenly break without switching modalities back to notebooks. It would be nice to develop solely using the quarto-cli without having to run notebooks in jupyter lab (with jupytext) or VSCode. It seems that the jupyter engine internally stops rendering once a cell throws, unlike other notebook servers. quarto-cli/src/resources/jupyter/notebook.py Line 293 in d4125e4 is where the code cells are executed. That function is also what throws an exception. Later in the code quarto-cli/src/resources/jupyter/notebook.py Line 359 in d4125e4 the notebook is written. Suggestion is to store the first exception, write the notebook, and then re-raise the exception for printing. There may be some additional engine code needed to print the exception but continue rendering even on a non-zero exit code. The proper condition should be if the qmd_ipynb is newer than the originally converted notebook. This would be quite helpful for writing notebooks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
See executions options, especially the The documentation is quite extensive but it has a search bar, which would lead to better answer than going through the codebase. |
Beta Was this translation helpful? Give feedback.
-
Ah, yes ok that is what I'm looking for. This particularly useful flag is a bit too subtle in the documentation for me. I looked around and was searching more for run options like nbconvert's "--allow-error" flag. |
Beta Was this translation helpful? Give feedback.
See executions options, especially the
error
one documented at:The documentation is quite extensive but it has a search bar, which would lead to better answer than going through the codebase.