added --autoreload
flag to NotebookApp
#4795
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the
--autoreload
flag is passed, the webapp will watch for any changes to its Python source. On change, all changed packages will be reimported and the webapp will restart. Also works on Python source files in Jupyter server extensions. Implemented using the built inautoreload
parameter in the constructor oftornado.web.Application
, whichNotebookApp.web_app
is a subclass of.While I was working on a server extension for Jupyterlab, I got pretty sick of having to kill and restart Jupyterlab every time I made changes to the Python source. This PR is an attempt to enable hot reloading for the sources of
notebook
and any extensions.Though the autoreload behavior is currently a bit cumbersome (the Notebook server will reload completely from scratch, including (on Jupyterlab, at least) launching a new browser window with a new security token), I believe that it is useful as is. I also think that in the future it can definitely be improved, most obviously by recycling certain resources on reload, such as browser windows and security tokens.