Auto reloading jupyter notebook when file changed on disk

Question:

I’d like to edit jupyter notebooks using an IDE (pycharm) for the autocomplete functionality. But pycharm isn’t very good at executing / previewing the results, so I’d like to keep the notebook open in the browser and automatically reload whenever the file changes on disk.

Ideal workflow:

  • Edit code in Pycharm
  • Automatically see updated code in browser and hit ctrl + enter to see output

Current workflow:

  • Edit code in Pycharm
  • Manually hit refresh in browser, sometimes see a browser warning and have to click a confirmation to reload, then see changes and hit ctrl + enter

I’ve tried:

#%load_ext autoreload
#%autoreload 2

but it doesn’t seem to do much.

Sometimes the browser detects that the file has changed (usually several seconds after its changed), but I then have to click two seperate confirmation dialogs to actually refresh the page.

Any ideas how it could just reload automatically whenever it changes on disc?

Asked By: Ali

||

Answers:

I’m not a PyCharm user ,
but you my look for a solution inside PyCharm, something like "preview" …

Other approach you may use somehing similar to it https://chrome.google.com/webstore/detail/easy-auto-refresh/aabcgdmkeabbnleenpncegpcngjpnjkc?hl=pt-BR
on your browser.

I dont think the answer relies on JuPyter.

Answered By: Carlos Leite