Make it possible to request a Kernel *without* creating editable code cells
I've been thinking for a while about how Thebelab could mimic the functionality of nbinteract (https://www.nbinteract.com). I think that one easy step could be something like the following:
-
Expose a configuration option that would request the kernel but wouldn't create CodeMirror cells (e.g.
codeMirror: false). This would add the Thebelab output area, but wouldn't change the input area. -
Document (or create a function for) running the code for a subset of cells (e.g.
runSelector: "[data-executable data-execute-on-bootstrap]"). This would basically do (after the kernel is created):thebelab.events.on("request-kernel")((kernel) => { document.querySelectorAll(`${runSelector}`).forEach((item) => { return kernel.requestExecute({code: <item contents>}) }});
Thus, you could create notebooks with the expectation that they'd render interactive plots backed by a kernel, but where the users would only need to click a button to create those plots.
What do folks think about that?
Since execution without user input necessarily requires custom javascript to trigger the execution, I think this one should probably be handled by requesting the kernel explicitly, rather than relying on thebelab bootstrap to do it.
thebelab.requestKernel(kernel => {
...
I'll have to see what hooking up output areas looks like for that.