At the protocol level, a kernel doesn’t know anything about a notebook document. The exceptions:
- the kernel process is started with the
cwd
of the folder holding the notebook - some clients provide the
cellId
in the metadata of some requests, and some kernels do something with it - but as metadata, this is not propagated back on replies from the kernel
So without a full client in the loop, your custom client would need to:
- parse the document itself
- find all the code cells
- punch them into the kernel
- remember which cell goes with which message id
- put them into the correct place
- write back to the contents manager
With a standard client in the loop, this becomes… a lot more complicated, as the state of the truth of the document can become out-of-sync.
There has been discussion on jupyter_server
of some this… perhaps the Thursday call would be a space to raise more of these concerns and questions.