From 41246fcc9d22fc471930e5ccb7059dfbfd745ea8 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Tue, 9 Feb 2016 14:58:35 -0800 Subject: [PATCH] Add an info blurb that prints if the notebook is a dev install Checks to see if the notebook is part of a git repo, if so suggest to the user `npm run build:watch` --- notebook/notebookapp.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index 55b85d8b1..6e0e90851 100644 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -98,6 +98,15 @@ jupyter notebook # start the notebook jupyter notebook --certfile=mycert.pem # use SSL/TLS certificate """ +DEV_NOTE_NPM = """It looks like you're running the notebook from source. +If you're working on the Javascript of the notebook, try running + + npm run build:watch + +in another terminal window to have the notebook incrementally +watch and build the Javascript for you, as you make changes. +""" + #----------------------------------------------------------------------------- # Helper functions #----------------------------------------------------------------------------- @@ -140,6 +149,13 @@ class NotebookWebApplication(web.Application): config_manager, log, base_url, default_url, settings_overrides, jinja_env_options): + # If the user is running the notebook in a git directory, make the assumption + # that this is a dev install and suggest to the developer `npm run build:watch`. + base_dir = os.path.realpath(os.path.join(__file__, '..', '..')) + dev_mode = os.path.exists(os.path.join(base_dir, '.git')) + if dev_mode: + log.info(DEV_NOTE_NPM) + settings = self.init_settings( ipython_app, kernel_manager, contents_manager, session_manager, kernel_spec_manager, config_manager, log, base_url, @@ -423,7 +439,7 @@ class NotebookApp(JupyterApp): ignore_minified_js = Bool(False, config=True, - help='Use minified JS file or not, mainly use during dev to avoid JS recompilation', + help='Deprecated: Use minified JS file or not, mainly use during dev to avoid JS recompilation', ) # file to be opened in the notebook server