Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added --autoreload flag to NotebookApp #4795

Merged
merged 2 commits into from
May 23, 2020

Conversation

telamonian
Copy link
Contributor

@telamonian telamonian commented Jul 31, 2019

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 in autoreload parameter in the constructor of tornado.web.Application, which NotebookApp.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.

Copy link
Contributor

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

@meeseeksmachine
Copy link

This pull request has been mentioned on Jupyter Community Forum. There might be relevant details there:

https://discourse.jupyter.org/t/reload-jupyter-serverextension/2200/3

@blink1073
Copy link
Contributor

@telamonian, do you mind rebasing this one?

@blink1073 blink1073 added this to the 6.1 milestone May 22, 2020
@telamonian
Copy link
Contributor Author

Can do

telamonian and others added 2 commits May 22, 2020 19:12
When 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 in `autoreload` parameter in the constructor of
`tornado.web.Application`.
@telamonian
Copy link
Contributor Author

telamonian commented May 22, 2020

@blink1073 done!

@blink1073
Copy link
Contributor

Thanks!

@blink1073 blink1073 merged commit 01e298f into jupyter:master May 23, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants