While Jupyter notebooks are commonly used interactively, with cells executed individually, to publish on Code Ocean, we ask that notebooks be executed as a whole. This allows notebooks to serve as a reproducible record of the analysis from start to finish.
To do so, add commands* to your master script to execute
jupyter nbconvert with the
--execute flag listed. This renders the final results into
/results as an HTML file.
jupyter nbconvert \
--ExecutePreprocessor.allow_errors=Trueflag isn't strictly necessary, but will reveal errors within the notebook, which makes debugging much easier.
--ExecutePreprocessor.timeout=-1flag will disable execution timeouts, allowing each cell to take as much time as it needs to execute.
- If you are using Python 3 you may need to specify the following flag:
- Code Ocean currently strips out the inline results from notebooks in the
/codepane. This showcases that all notebooks in the
/resultshave been successfully rendered in the Code Ocean environment.
- See nbconvert's excellent documentation for more details
*These commands can also be used to render a Jupyter notebook directly from the command line.