thebe icon indicating copy to clipboard operation
thebe copied to clipboard

Make it possible to request a Kernel *without* creating editable code cells

Open choldgraf opened this issue 7 years ago • 1 comments

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:

  1. 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.

  2. 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?

choldgraf avatar Jan 14 '19 18:01 choldgraf

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.

minrk avatar Jan 15 '19 11:01 minrk