Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Auto-reload current file in Jupyter Notebook? #22

Closed
hejops opened this issue Jan 27, 2021 · 4 comments
Closed

Auto-reload current file in Jupyter Notebook? #22

hejops opened this issue Jan 27, 2021 · 4 comments
Labels
question Further information is requested

Comments

@hejops
Copy link

hejops commented Jan 27, 2021

Probably not the best place to ask this question, but I'm quite new to Jupyter Notebook, so I'll give it a try. I do all my notebook editing in vim through this plugin, but any changes made are not reflected in Jupyter Notebook until a manual reload is done in JN; I can verify that both the .ipynb and .py files have changed on disk. Is there any way to automatically trigger a reload of the .ipynb file within JN?

I've tried something like this, but as far as I can tell it applies to submodules that the current file relies on, and not the current file itself.

@mwouts
Copy link
Contributor

mwouts commented Jan 27, 2021

Hi @hejops , you don't need autoreload here, that is for a different use case (edit your .py modules and use them without having to restart your Jupyter Kernel)

What you need here is

  • F5 or Ctrl + R (reload the web page) in Jupyter Notebook
  • Reload Notebook From Disk in the File menu in Jupyter Lab >= 3.0

@hejops
Copy link
Author

hejops commented Jan 28, 2021

Thanks. Does vim potentially have any control of a Jupyter server/browser? I was thinking a BufWritePost autocmd could work nicely, but I doubt vim has that kind of control.

@anuramat
Copy link

anuramat commented May 8, 2024

jupyterlab with jupyter-collaboration plugin will automatically reload the notebook, keeping the old outputs

@goerz
Copy link
Owner

goerz commented May 31, 2024

I would also note that jupytext.vim is primarily for when you don't have a Jupyter server running, to edit random .ipynb files. If you do have Jupyter running, then it's better to use the actual Jupytext Jupyter-plugin, pair your notebooks, and edit the paired files. You will still need "Reload Notebook From Disk" (or whatever improvements Jupyter will bring to this in the future)

In any case: this would be Jupyter's responsibility, not vim's.

jupyterlab with jupyter-collaboration plugin will automatically reload the notebook, keeping the old outputs

Unfortunately, Jupytext (the Jupyter-plugin, not this vim plugin) is incompatible with the jupyter-collabortation plugin: jupyterlab/jupyter-collaboration#214

@goerz goerz closed this as completed May 31, 2024
@goerz goerz added the question Further information is requested label May 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants