dccsillag / magma-nvim

Interact with Jupyter from NeoVim.
GNU General Public License v3.0
977 stars 49 forks source link

Add jupyter server api runtime #99

Open opqrstuvcut opened 1 year ago

opqrstuvcut commented 1 year ago

I worked on implementing the ability to run the kernel of jupyter notebook and jupyter lab using the jupyter server api.

For example, suppose you are running jupyter lab as follows.

jupyter lab --ip=0.0.0.0 --port=8080 --NotebookApp.token='token' 

On neovim, run MagmaInit as follows.

:MagmaInit http://localhost:8080/lab?token=token 
WhiteBlackGoose commented 1 year ago

Looks interesting. There's already a feature though, which allows to connect to a running kernel via files:

jupyter console -f /tmp/file.json

and then :MagmaInit /tmp/file.json

But for some reason for me jupyter lab -f /tmp/file.json does not create this file, I guess it works differently. Never worked with jupyter lab

opqrstuvcut commented 1 year ago

Thanks for the review. In my case, I found copying the json files on the server to local to be a hassle and also using jupyter console was not suitable for my operation.

WhiteBlackGoose commented 1 year ago

Well, it seems to be working fine :smile: . Will need some time though to decide for sure.

I'll need to expand the docs on the MagmaInit command later though