As someone who has done a lot of work in the Jupyter Book ecosystem, one of the biggest pain points comes from trying to render a notebook’s outputs outside of the environment where they were generated.
This is especially true for interactive outputs - things like Bokeh, plotly, ipywidgets, etc. While the outputs do make it into the notebook (setting aside widget state etc), one has to manually load the relevant JS libraries in order to visualize those outputs. This means that you have to look through documentation and often codebases in order to remember to manually load the right library.
As an example, see this bqplot example in
thebe/. The first cell is to manually include
require.js as well as the relevant JS library for the visualization. Without this, the page won’t know what to do with the output.
One way that some libraries have gotten past this is by bundling the entire JS blob with the outputs themselves (I believe some of plotly’s renderers do this). However, this is sub-optimal because the notebooks are huge and even less diffable before.
One solution: make a standard
I think it would be really useful if there were a standard around how to store dependencies of cell outputs. For example, the output metadata could have a
dependencies/ structure. This could have references to JS libraries or other programmatic instructions for displaying (or at least saying what’s needed in order to display) the outputs of the cell.
If this existed, a downstream environment (like a static HTML page rendered by Jupyter Book). Could simply look at an interactive output’s
dependencies field, and then have all of the instructions needed to recreate that cell output.
Do others think that this would help as well? Or have ideas for a different way to solve this issue? Would love to know what people think.