From e5fefbae07d1a76ae7147b8399549b3e792d1cf9 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Fri, 25 Feb 2022 10:19:03 +0100 Subject: [PATCH] Update shim, notebook app name --- CONTRIBUTING.md | 2 +- jupyter_config.json | 3 ++- notebook/__init__.py | 16 +++++----------- notebook/app.py | 7 ++++--- ui-tests/playwright.config.ts | 2 +- ui-tests/test/jupyter_server_config.py | 3 ++- 6 files changed, 15 insertions(+), 18 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2d3226201..afb088a5e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,7 +19,7 @@ The `jlpm` command is JupyterLab's pinned version of [yarn](https://yarnpkg.com/ mamba create -n notebook -c conda-forge python nodejs -y # activate the environment -conda activate notebook +mamba activate notebook # Install package in development mode pip install -e . diff --git a/jupyter_config.json b/jupyter_config.json index aea94da87..f00d47ca2 100644 --- a/jupyter_config.json +++ b/jupyter_config.json @@ -1,3 +1,4 @@ { - "LabApp": { "collaborative": true, "expose_app_in_browser": true } + "LabApp": { "collaborative": true, "expose_app_in_browser": true }, + "JupyterNotebookApp": { "collaborative": true, "expose_app_in_browser": true } } diff --git a/notebook/__init__.py b/notebook/__init__.py index 355c38ceb..83759356a 100644 --- a/notebook/__init__.py +++ b/notebook/__init__.py @@ -2,20 +2,14 @@ from ._version import __version__ def _jupyter_server_extension_paths(): - return [ - { - 'module': 'notebook' - } - ] + return [{"module": "notebook"}] def _jupyter_server_extension_points(): - from .app import NotebookApp - return [{"module": "notebook", "app": NotebookApp}] + from .app import JupyterNotebookApp + + return [{"module": "notebook", "app": JupyterNotebookApp}] def _jupyter_labextension_paths(): - return [{ - 'src': 'labextension', - 'dest': '@jupyter-notebook/lab-extension' - }] \ No newline at end of file + return [{"src": "labextension", "dest": "@jupyter-notebook/lab-extension"}] diff --git a/notebook/app.py b/notebook/app.py index a0e7568cb..f3b25b5e9 100644 --- a/notebook/app.py +++ b/notebook/app.py @@ -13,6 +13,7 @@ from jupyterlab.commands import get_app_dir, get_user_settings_dir, get_workspac from jupyterlab_server import LabServerApp from jupyterlab_server.config import get_page_config, recursive_update, LabConfig from jupyterlab_server.handlers import is_url, _camelCase +from notebook_shim.shim import NotebookConfigShimMixin from tornado import web from tornado.gen import maybe_future from traitlets import Bool @@ -168,13 +169,13 @@ class NotebookHandler(NotebookBaseHandler): aliases = dict(base_aliases) -class NotebookApp(LabServerApp): +class JupyterNotebookApp(NotebookConfigShimMixin, LabServerApp): name = "notebook" app_name = "Jupyter Notebook" description = "Jupyter Notebook - A web-based notebook environment for interactive computing" version = version app_version = version - extension_url = "/tree" + extension_url = "/" default_url = "/tree" file_url_prefix = "/notebooks" load_other_extensions = True @@ -237,7 +238,7 @@ class NotebookApp(LabServerApp): super().initialize() -main = launch_new_instance = NotebookApp.launch_instance +main = launch_new_instance = JupyterNotebookApp.launch_instance if __name__ == "__main__": main() diff --git a/ui-tests/playwright.config.ts b/ui-tests/playwright.config.ts index afc0aa538..27431805d 100644 --- a/ui-tests/playwright.config.ts +++ b/ui-tests/playwright.config.ts @@ -4,7 +4,7 @@ module.exports = { ...baseConfig, timeout: 240000, use: { - appPath: '/' + appPath: '' }, retries: 1 }; diff --git a/ui-tests/test/jupyter_server_config.py b/ui-tests/test/jupyter_server_config.py index 78929fa47..02a79f725 100644 --- a/ui-tests/test/jupyter_server_config.py +++ b/ui-tests/test/jupyter_server_config.py @@ -8,4 +8,5 @@ c.ServerApp.root_dir = mkdtemp(prefix="galata-test-") c.ServerApp.token = "" c.ServerApp.password = "" c.ServerApp.disable_check_xsrf = True -c.NotebookApp.expose_app_in_browser = True + +c.JupyterNotebookApp.expose_app_in_browser = True