Open kiyoon opened 1 year ago
Jupynium is the only tool I know of that is used for serious production purposes with Jupyter Notebook, rather than just for tutorials or demonstrations. It connects the notebook with a fully featured editor (Neovim), allowing it to serve as the frontend for the editor.
I am eagerly looking forward to seeing this feature implemented in Notebook v7!
Thanks @kiyoon and @fecet for reporting the issue and commenting :+1:
without needing to write extensions
So does that mean jupynium
does not even use the classic notebook extension system at the moment? And instead execute these commands directly via the Selenium driver?
Probably because jupynium
is in full control of the browser as opposed to regular Jupyter use cases where a user opens Jupyter Notebook in the browser?
Notebook 7 provides a JavaScript / TypeScript API and it's the same as JupyterLab. But the recommended way would indeed be to write an extension and use the JupyterLab API. There is some documentation about this here and in related links on the page: https://jupyterlab.readthedocs.io/en/latest/extension/extension_dev.html
Probably the jupynium
functionalities could be implemented as a set of commands, but that would still require writing an extension to add the commands. But writing a JupyterLab / Notebook 7 extension could also have the benefit of supporting JupyterLab as well and not just the Notebook interface.
To achieve the same without writing an extension might be a bit trickier at the moment. You could use the --expose-app-in-browser
flag when starting Notebook 7 so it makes window.jupyterapp
available in the browser. And then register commands and perform actions on jupyterapp
directly.
For reference there has also been some discussions about having a small compatibility layer for classic notebook extensions (as a separate package): https://github.com/jupyter/notebook/issues/6394
This could help with some of this, but not sure all the classic notebook APIs would be supported.
Hi @jtpio,
So does that mean jupynium does not even use the classic notebook extension system at the moment? And instead execute these commands directly via the Selenium driver?
Yes, this is correct. There are multiple benefits by going on this route.
jupynium
runs locally, and Jupyter Notebook can potentially run anywhere (e.g. a remote machine). If we write an extension, then updating the plugin requires matching the version of the extension on all the machines you are using. Currently, jupynium
only interacts through front-end, making it possible to be compatible with every Notebook installed without worrying about extensions.Is there any documentation for --expose-app-in-browser
? I tried it but I don't know how I should find the equivalent commands.
For example, is there an equivalent of Jupyter.notebook.get_cell(0).set_text(arguments[0])
with this method?
Problem
In the neovim plugin jupynium.nvim it uses Notebook's front-end APIs to interact with the Notebook, allowing users to edit on vim and the changes are made to Notebook in real time.
Here is the list of functions that is used.
Proposed Solution
If Notebook v7 provides a similar front-end API without needing to write extensions, it would be much easier to migrate.
Additional context