kotlin-jupyter
kotlin-jupyter copied to clipboard
Cell and notebook reflection API
This issue is actually an extension of #78. The idea is to have interfaces that define cell and notebook status. Those interfaces should be placed in an external artifact that is available to plugin and library developers. When inside the notebook the instances of those interfaces could be obtained as implicit calls. My idea is that the whole code executed in a cell should be done with a cell receiver. During notebook execution, this cell receiver is substituted by the actual cell object.
The following features should be supported.
Cell:
- [x]
val id: String
. A unique cell id. - [x]
val notebook: Notebook
. Get a reference to a current notebook. - [x]
val/var text: String
. The code inside the cell (see #76 ). - [x]
val output: MIMEContainer
. The output as MIMEContainer. - [x]
val rawOutput: String
. Raw output. - [ ] Specific notebooks controls like hide input/output.
- [ ] Execution controls. Maybe asynchronous cell result.
Notebook:
- [ ] Kernel handle.
- [ ] A collection of resource handles with the possibility to inject new resources in runtime (see #74 ). The resources must provide asynchronous load handles or a javascript promise name so one could organize asynchronous loading of widgets.
- [x] Find a
Cell
by id.
May be unrelated, but it would be nice to have hooks into the Jupyter notebook rendering system in order to display custom result types (e.g. Javascript
, Latex
, Markdown
, SVG
) similar to how the Python API is implemented. Skimmed the code and it looks like some are already supported, but perhaps I missed the other MIME types.
edit: Ah, this looks like a duplicate of #12.