Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create and execute a cell in Jupyter Notebook server from a separate process (e.g., an editor, vim)?

I want to call an api on a running jupyter notebook to create or edit an existing cell, and to run it. When this is done, the browser page should also update, to show both the contents of the cell, and the output.

The intended use case for this api is a plugin for the vim editor that will take highlighted lines and execute them. The motivation for using jupyter notebook is that will allow visualization of plots and images using matplotlib, even though both vim and the notebook will be running on a remote server. The user would have a browser page open to the notebook, and separately a terminal open potentially that is ssh'ed to the machine and editing python code.

VSCode does exactly this in its python interactive mode, but I prefer to use the vim editor natively than switch to vscode simply to be able to do this.

like image 511
eyeApps LLC Avatar asked Oct 18 '25 13:10

eyeApps LLC


1 Answers

There are several plugins being actively developed for this, and without having used them, it seems only vimpyter interacts with jupyter on the browser. Others like jupyter-vim and vim-ipython open the notebook inside a vim buffer.

If you can live without inline plots I find confortable having a neoterm terminal buffer where I can send lines to and from IPython.

like image 71
Marco Crivaro Nicolini Avatar answered Oct 21 '25 03:10

Marco Crivaro Nicolini



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!