From b7aad78b82bc7dc67150fa8f1f2821968cfd00a0 Mon Sep 17 00:00:00 2001 From: romainx Date: Fri, 8 Jan 2021 09:13:01 +0100 Subject: [PATCH 1/6] Switch to JupyterLab by default --- base-notebook/start-notebook.sh | 10 +++++-- base-notebook/test/test_start_script.py | 37 +++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 base-notebook/test/test_start_script.py diff --git a/base-notebook/start-notebook.sh b/base-notebook/start-notebook.sh index f893af161..3b0f20575 100755 --- a/base-notebook/start-notebook.sh +++ b/base-notebook/start-notebook.sh @@ -12,8 +12,12 @@ fi if [[ ! -z "${JUPYTERHUB_API_TOKEN}" ]]; then # launched by JupyterHub, use single-user entrypoint exec /usr/local/bin/start-singleuser.sh "$@" -elif [[ ! -z "${JUPYTER_ENABLE_LAB}" ]]; then - . /usr/local/bin/start.sh $wrapper jupyter lab "$@" -else +elif [[ ! -z "${JUPYTER_ENABLE_NB}" ]]; then + echo "WARN: We encourage users to transition to JupyterLab, Notebook support could be removed" . /usr/local/bin/start.sh $wrapper jupyter notebook "$@" +else + if [[ ! -z "${JUPYTER_ENABLE_LAB}" ]]; then + echo "WARN: The JUPYTER_ENABLE_LAB environment variable is not required anymore" + fi + . /usr/local/bin/start.sh $wrapper jupyter lab "$@" fi diff --git a/base-notebook/test/test_start_script.py b/base-notebook/test/test_start_script.py new file mode 100644 index 000000000..4697bfb1b --- /dev/null +++ b/base-notebook/test/test_start_script.py @@ -0,0 +1,37 @@ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. + +import logging +import pytest + +LOGGER = logging.getLogger(__name__) + + +@pytest.mark.parametrize( + "env,expected_server", + [ + (["JUPYTER_ENABLE_NB=yes"], "notebook"), + (["JUPYTER_ENABLE_LAB=yes"], "lab"), + (None, "lab"), + ], +) +def test_start_notebook(container, http_client, env, expected_server): + """Test the notebook start-notebook script""" + LOGGER.info( + f"Test that the start-notebook launches the {expected_server} server from the env {env} ..." + ) + c = container.run(tty=True, environment=env, command=["start-notebook.sh"]) + resp = http_client.get("http://localhost:8888") + assert resp.status_code == 200, "Server is not listening" + logs = c.logs(stdout=True).decode("utf-8") + LOGGER.debug(logs) + assert ( + f"Executing the command: jupyter {expected_server}" in logs + ), f"Not the expected command (jupyter {expected_server}) was launched" + if env: + # Checking warning messages + if "JUPYTER_ENABLE_LAB=yes" in env: + msg = "WARN: The JUPYTER_ENABLE_LAB environment variable is not required anymore" + elif "JUPYTER_ENABLE_NB=yes" in env: + msg = "WARN: We encourage users to transition to JupyterLab, Notebook support could be removed" + assert msg in logs, f"Expected warning message {msg} not printed" From 0660736ac06188030170c334eb6090fb9d5d1669 Mon Sep 17 00:00:00 2001 From: romainx Date: Mon, 18 Jan 2021 07:43:26 +0100 Subject: [PATCH 2/6] Changes following the review --- README.md | 7 +++++++ base-notebook/start-notebook.sh | 11 ++++------- base-notebook/test/test_start_script.py | 12 ++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 17e6d805b..a1ed28547 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,13 @@ Anyone in the community can jump in and help with these activities at any time. grant additional permissions (e.g., ability to merge PRs) to anyone who shows an on-going interest in working on the project. +## Jupyter Notebook Deprecation Notice + +Following [Jupyter Notebook notice](https://github.com/jupyter/notebook#notice), we encourage users to transition to JupyterLab. +This can be done by passing the environment variable `JUPYTER_ENABLE_LAB=yes` at container startup, +more information in the [documentation](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/common.html). +This change is followed in the issue [#1217](https://github.com/jupyter/docker-stacks/issues/1217). + ## Quick Start You can try a diff --git a/base-notebook/start-notebook.sh b/base-notebook/start-notebook.sh index 3b0f20575..3ff3a88ea 100755 --- a/base-notebook/start-notebook.sh +++ b/base-notebook/start-notebook.sh @@ -12,12 +12,9 @@ fi if [[ ! -z "${JUPYTERHUB_API_TOKEN}" ]]; then # launched by JupyterHub, use single-user entrypoint exec /usr/local/bin/start-singleuser.sh "$@" -elif [[ ! -z "${JUPYTER_ENABLE_NB}" ]]; then - echo "WARN: We encourage users to transition to JupyterLab, Notebook support could be removed" - . /usr/local/bin/start.sh $wrapper jupyter notebook "$@" -else - if [[ ! -z "${JUPYTER_ENABLE_LAB}" ]]; then - echo "WARN: The JUPYTER_ENABLE_LAB environment variable is not required anymore" - fi +elif [[ ! -z "${JUPYTER_ENABLE_LAB}" ]]; then . /usr/local/bin/start.sh $wrapper jupyter lab "$@" +else + echo "WARN: Jupyter Notebook deprecation notice https://github.com/jupyter/notebook#notice." + . /usr/local/bin/start.sh $wrapper jupyter notebook "$@" fi diff --git a/base-notebook/test/test_start_script.py b/base-notebook/test/test_start_script.py index 4697bfb1b..76575e414 100644 --- a/base-notebook/test/test_start_script.py +++ b/base-notebook/test/test_start_script.py @@ -10,9 +10,8 @@ @pytest.mark.parametrize( "env,expected_server", [ - (["JUPYTER_ENABLE_NB=yes"], "notebook"), (["JUPYTER_ENABLE_LAB=yes"], "lab"), - (None, "lab"), + (None, "notebook"), ], ) def test_start_notebook(container, http_client, env, expected_server): @@ -28,10 +27,7 @@ def test_start_notebook(container, http_client, env, expected_server): assert ( f"Executing the command: jupyter {expected_server}" in logs ), f"Not the expected command (jupyter {expected_server}) was launched" - if env: - # Checking warning messages - if "JUPYTER_ENABLE_LAB=yes" in env: - msg = "WARN: The JUPYTER_ENABLE_LAB environment variable is not required anymore" - elif "JUPYTER_ENABLE_NB=yes" in env: - msg = "WARN: We encourage users to transition to JupyterLab, Notebook support could be removed" + # Checking warning messages + if not env: + msg = "WARN: Jupyter Notebook deprecation notice https://github.com/jupyter/notebook#notice." assert msg in logs, f"Expected warning message {msg} not printed" From 13bf51f6a7970cb4bff0b0883864fb5b3732047f Mon Sep 17 00:00:00 2001 From: romainx Date: Mon, 18 Jan 2021 18:02:29 +0100 Subject: [PATCH 3/6] Fix according to the review --- README.md | 9 +++++++-- base-notebook/start-notebook.sh | 2 +- base-notebook/test/test_start_script.py | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a1ed28547..7053e8661 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,13 @@ in working on the project. Following [Jupyter Notebook notice](https://github.com/jupyter/notebook#notice), we encourage users to transition to JupyterLab. This can be done by passing the environment variable `JUPYTER_ENABLE_LAB=yes` at container startup, -more information in the [documentation](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/common.html). -This change is followed in the issue [#1217](https://github.com/jupyter/docker-stacks/issues/1217). +more information is available in the [documentation](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/common.html). + +In April 2021 JupyterLab will become the default, however a new environment variable will be introduced to switch back to Jupyter Notebook if needed. + +Next, and according to the Jupyter Notebook project status and its compatibility with JupyterLab, it could be abandoned in favor of another *classic-like* UI. + +This change is tracked in the issue [#1217](https://github.com/jupyter/docker-stacks/issues/1217), please check its content for more information. ## Quick Start diff --git a/base-notebook/start-notebook.sh b/base-notebook/start-notebook.sh index 3ff3a88ea..499634af7 100755 --- a/base-notebook/start-notebook.sh +++ b/base-notebook/start-notebook.sh @@ -15,6 +15,6 @@ if [[ ! -z "${JUPYTERHUB_API_TOKEN}" ]]; then elif [[ ! -z "${JUPYTER_ENABLE_LAB}" ]]; then . /usr/local/bin/start.sh $wrapper jupyter lab "$@" else - echo "WARN: Jupyter Notebook deprecation notice https://github.com/jupyter/notebook#notice." + echo "WARN: Jupyter Notebook deprecation notice https://github.com/jupyter/docker-stacks#jupyter-notebook-deprecation-notice." . /usr/local/bin/start.sh $wrapper jupyter notebook "$@" fi diff --git a/base-notebook/test/test_start_script.py b/base-notebook/test/test_start_script.py index 76575e414..8b3f97593 100644 --- a/base-notebook/test/test_start_script.py +++ b/base-notebook/test/test_start_script.py @@ -29,5 +29,5 @@ def test_start_notebook(container, http_client, env, expected_server): ), f"Not the expected command (jupyter {expected_server}) was launched" # Checking warning messages if not env: - msg = "WARN: Jupyter Notebook deprecation notice https://github.com/jupyter/notebook#notice." + msg = "WARN: Jupyter Notebook deprecation notice" assert msg in logs, f"Expected warning message {msg} not printed" From bba54316492636e158ac5aa4626a441b3373a256 Mon Sep 17 00:00:00 2001 From: Romain Date: Mon, 18 Jan 2021 18:53:57 +0100 Subject: [PATCH 4/6] Update README.md Co-authored-by: Peter Parente --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7053e8661..639f44903 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ more information is available in the [documentation](https://jupyter-docker-stac In April 2021 JupyterLab will become the default, however a new environment variable will be introduced to switch back to Jupyter Notebook if needed. -Next, and according to the Jupyter Notebook project status and its compatibility with JupyterLab, it could be abandoned in favor of another *classic-like* UI. +After the change of default, and according to the Jupyter Notebook project status and its compatibility with JupyterLab, these Docker images may remove the classic Jupyter Notebook interface altogether in favor of another *classic-like* UI built atop JupyterLab. This change is tracked in the issue [#1217](https://github.com/jupyter/docker-stacks/issues/1217), please check its content for more information. From 92e0766332d4708962c46f1d8140c5360acf75a4 Mon Sep 17 00:00:00 2001 From: Romain Date: Mon, 18 Jan 2021 18:54:32 +0100 Subject: [PATCH 5/6] Update README.md Co-authored-by: Ayaz Salikhov --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 639f44903..c9adbf516 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ in working on the project. Following [Jupyter Notebook notice](https://github.com/jupyter/notebook#notice), we encourage users to transition to JupyterLab. This can be done by passing the environment variable `JUPYTER_ENABLE_LAB=yes` at container startup, -more information is available in the [documentation](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/common.html). +more information is available in the [documentation](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/common.html#docker-options). In April 2021 JupyterLab will become the default, however a new environment variable will be introduced to switch back to Jupyter Notebook if needed. From 21a94a2ed5ece04f5ddc31269b8f694c0b66e08b Mon Sep 17 00:00:00 2001 From: Romain Date: Mon, 18 Jan 2021 18:54:56 +0100 Subject: [PATCH 6/6] Update README.md Co-authored-by: Peter Parente --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c9adbf516..f15301d66 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Following [Jupyter Notebook notice](https://github.com/jupyter/notebook#notice), This can be done by passing the environment variable `JUPYTER_ENABLE_LAB=yes` at container startup, more information is available in the [documentation](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/common.html#docker-options). -In April 2021 JupyterLab will become the default, however a new environment variable will be introduced to switch back to Jupyter Notebook if needed. +In April 2021 JupyterLab will become the default for all of the Jupyter Docker stack images, however a new environment variable will be introduced to switch back to Jupyter Notebook if needed. After the change of default, and according to the Jupyter Notebook project status and its compatibility with JupyterLab, these Docker images may remove the classic Jupyter Notebook interface altogether in favor of another *classic-like* UI built atop JupyterLab.