From e81957ffdaf6c3c63148fd90f83136c323157a65 Mon Sep 17 00:00:00 2001 From: romainx Date: Sun, 27 Dec 2020 17:02:14 +0100 Subject: [PATCH 1/7] Regular update: 2020-12-27 --- base-notebook/Dockerfile | 6 +++--- datascience-notebook/Dockerfile | 2 +- r-notebook/Dockerfile | 2 +- scipy-notebook/Dockerfile | 19 +++++++++---------- tensorflow-notebook/Dockerfile | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/base-notebook/Dockerfile b/base-notebook/Dockerfile index f2e147ab36..8692187c09 100644 --- a/base-notebook/Dockerfile +++ b/base-notebook/Dockerfile @@ -131,9 +131,9 @@ RUN wget --quiet "https://github.com/conda-forge/miniforge/releases/download/${m # Do all this in a single RUN command to avoid duplicating all of the # files across image layers when the permissions change RUN conda install --quiet --yes \ - 'notebook=6.1.5' \ - 'jupyterhub=1.2.2' \ - 'jupyterlab=2.2.9' && \ + 'notebook=6.1.6' \ + 'jupyterhub=1.3.0' \ + 'jupyterlab=3.0.0' && \ conda clean --all -f -y && \ npm cache clean --force && \ jupyter notebook --generate-config && \ diff --git a/datascience-notebook/Dockerfile b/datascience-notebook/Dockerfile index 3296bbee9c..7965381aa9 100644 --- a/datascience-notebook/Dockerfile +++ b/datascience-notebook/Dockerfile @@ -70,7 +70,7 @@ RUN conda install --quiet --yes \ 'r-nycflights13=1.0*' \ 'r-randomforest=4.6*' \ 'r-rcurl=1.98*' \ - 'r-rmarkdown=2.5*' \ + 'r-rmarkdown=2.6*' \ 'r-rsqlite=2.2*' \ 'r-shiny=1.5*' \ 'r-tidyverse=1.3*' \ diff --git a/r-notebook/Dockerfile b/r-notebook/Dockerfile index d316de97ce..190de532cb 100644 --- a/r-notebook/Dockerfile +++ b/r-notebook/Dockerfile @@ -37,7 +37,7 @@ RUN conda install --quiet --yes \ 'r-nycflights13=1.0*' \ 'r-randomforest=4.6*' \ 'r-rcurl=1.98*' \ - 'r-rmarkdown=2.5*' \ + 'r-rmarkdown=2.6*' \ 'r-rodbc=1.3*' \ 'r-rsqlite=2.2*' \ 'r-shiny=1.5*' \ diff --git a/scipy-notebook/Dockerfile b/scipy-notebook/Dockerfile index 2a634b1a0c..8be65d8979 100644 --- a/scipy-notebook/Dockerfile +++ b/scipy-notebook/Dockerfile @@ -22,20 +22,20 @@ RUN conda install --quiet --yes \ 'bottleneck=1.3.*' \ 'cloudpickle=1.6.*' \ 'cython=0.29.*' \ - 'dask=2.30.*' \ + 'dask=2020.12.*' \ 'dill=0.3.*' \ 'h5py=3.1.*' \ - 'ipywidgets=7.5.*' \ + 'ipywidgets=7.6.*' \ 'ipympl=0.5.*'\ 'matplotlib-base=3.3.*' \ - 'numba=0.51.*' \ + 'numba=0.52.*' \ 'numexpr=2.7.*' \ 'pandas=1.1.*' \ 'patsy=0.5.*' \ - 'protobuf=3.13.*' \ + 'protobuf=3.14.*' \ 'pytables=3.6.*' \ - 'scikit-image=0.17.*' \ - 'scikit-learn=0.23.*' \ + 'scikit-image=0.18.*' \ + 'scikit-learn=0.24.*' \ 'scipy=1.5.*' \ 'seaborn=0.11.*' \ 'sqlalchemy=1.3.*' \ @@ -50,10 +50,9 @@ RUN conda install --quiet --yes \ jupyter nbextension enable --py widgetsnbextension --sys-prefix && \ # Also activate ipywidgets extension for JupyterLab # Check this URL for most recent compatibilities - # https://github.com/jupyter-widgets/ipywidgets/tree/master/packages/jupyterlab-manager - jupyter labextension install @jupyter-widgets/jupyterlab-manager@^2.0.0 --no-build && \ - jupyter labextension install @bokeh/jupyter_bokeh@^2.0.0 --no-build && \ - jupyter labextension install jupyter-matplotlib@^0.7.2 --no-build && \ + # Not compliant with jupyterlab 3.0.x see https://github.com/bokeh/bokeh/issues/10569 + #jupyter labextension install @bokeh/jupyter_bokeh@^2.0.4 --no-build && \ + jupyter labextension install jupyter-matplotlib@^0.7.4 --no-build && \ jupyter lab build -y && \ jupyter lab clean -y && \ npm cache clean --force && \ diff --git a/tensorflow-notebook/Dockerfile b/tensorflow-notebook/Dockerfile index 1ad8ce1405..ce20cf84b7 100644 --- a/tensorflow-notebook/Dockerfile +++ b/tensorflow-notebook/Dockerfile @@ -7,6 +7,6 @@ LABEL maintainer="Jupyter Project " # Install Tensorflow RUN pip install --quiet --no-cache-dir \ - 'tensorflow==2.3.1' && \ + 'tensorflow==2.4.0' && \ fix-permissions "${CONDA_DIR}" && \ fix-permissions "/home/${NB_USER}" From c41616d7f30ed957f1fdf523819d328083270062 Mon Sep 17 00:00:00 2001 From: romainx Date: Tue, 29 Dec 2020 17:44:16 +0100 Subject: [PATCH 2/7] #1205: Fix the configuration in jupyter_server_config.py --- base-notebook/Dockerfile | 2 +- ...{jupyter_notebook_config.py => jupyter_server_config.py} | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) rename base-notebook/{jupyter_notebook_config.py => jupyter_server_config.py} (95%) diff --git a/base-notebook/Dockerfile b/base-notebook/Dockerfile index 8692187c09..4927598830 100644 --- a/base-notebook/Dockerfile +++ b/base-notebook/Dockerfile @@ -150,7 +150,7 @@ CMD ["start-notebook.sh"] # Copy local files as late as possible to avoid cache busting COPY start.sh start-notebook.sh start-singleuser.sh /usr/local/bin/ -COPY jupyter_notebook_config.py /etc/jupyter/ +COPY jupyter_server_config.py /etc/jupyter/ # Fix permissions on /etc/jupyter as root USER root diff --git a/base-notebook/jupyter_notebook_config.py b/base-notebook/jupyter_server_config.py similarity index 95% rename from base-notebook/jupyter_notebook_config.py rename to base-notebook/jupyter_server_config.py index 19b5e8b431..f73dbc4961 100644 --- a/base-notebook/jupyter_notebook_config.py +++ b/base-notebook/jupyter_server_config.py @@ -8,9 +8,9 @@ import stat c = get_config() # noqa: F821 -c.NotebookApp.ip = '0.0.0.0' -c.NotebookApp.port = 8888 -c.NotebookApp.open_browser = False +c.ServerApp.ip = '0.0.0.0' +c.ServerApp.port = 8888 +c.ServerApp.open_browser = False # https://github.com/jupyter/notebook/issues/3130 c.FileContentsManager.delete_to_trash = False From 9648e05b7c6ad95cbfd92ad6c4756bd63e52a712 Mon Sep 17 00:00:00 2001 From: romainx Date: Tue, 29 Dec 2020 17:51:44 +0100 Subject: [PATCH 3/7] #1205: Fix c.ServerApp.certfile --- base-notebook/jupyter_server_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base-notebook/jupyter_server_config.py b/base-notebook/jupyter_server_config.py index f73dbc4961..97adace485 100644 --- a/base-notebook/jupyter_server_config.py +++ b/base-notebook/jupyter_server_config.py @@ -47,7 +47,7 @@ '-out', pem_file]) # Restrict access to the file os.chmod(pem_file, stat.S_IRUSR | stat.S_IWUSR) - c.NotebookApp.certfile = pem_file + c.ServerApp.certfile = pem_file # Change default umask for all subprocesses of the notebook server if set in # the environment From 96deb9f4d2bdba670b7d7e67cc9ca35e0a1cfcb6 Mon Sep 17 00:00:00 2001 From: romainx Date: Tue, 29 Dec 2020 20:54:30 +0100 Subject: [PATCH 4/7] #1205: Manage both config files --- base-notebook/Dockerfile | 3 +- base-notebook/jupyter_notebook_config.py | 55 ++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 base-notebook/jupyter_notebook_config.py diff --git a/base-notebook/Dockerfile b/base-notebook/Dockerfile index 4927598830..b140db19bd 100644 --- a/base-notebook/Dockerfile +++ b/base-notebook/Dockerfile @@ -150,7 +150,8 @@ CMD ["start-notebook.sh"] # Copy local files as late as possible to avoid cache busting COPY start.sh start-notebook.sh start-singleuser.sh /usr/local/bin/ -COPY jupyter_server_config.py /etc/jupyter/ +# Need to have both files to be able to use classic and lab +COPY jupyter_notebook_config.py jupyter_server_config.py /etc/jupyter/ # Fix permissions on /etc/jupyter as root USER root diff --git a/base-notebook/jupyter_notebook_config.py b/base-notebook/jupyter_notebook_config.py new file mode 100644 index 0000000000..19b5e8b431 --- /dev/null +++ b/base-notebook/jupyter_notebook_config.py @@ -0,0 +1,55 @@ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. + +from jupyter_core.paths import jupyter_data_dir +import subprocess +import os +import errno +import stat + +c = get_config() # noqa: F821 +c.NotebookApp.ip = '0.0.0.0' +c.NotebookApp.port = 8888 +c.NotebookApp.open_browser = False + +# https://github.com/jupyter/notebook/issues/3130 +c.FileContentsManager.delete_to_trash = False + +# Generate a self-signed certificate +if 'GEN_CERT' in os.environ: + dir_name = jupyter_data_dir() + pem_file = os.path.join(dir_name, 'notebook.pem') + try: + os.makedirs(dir_name) + except OSError as exc: # Python >2.5 + if exc.errno == errno.EEXIST and os.path.isdir(dir_name): + pass + else: + raise + + # Generate an openssl.cnf file to set the distinguished name + cnf_file = os.path.join(os.getenv('CONDA_DIR', '/usr/lib'), 'ssl', 'openssl.cnf') + if not os.path.isfile(cnf_file): + with open(cnf_file, 'w') as fh: + fh.write('''\ +[req] +distinguished_name = req_distinguished_name +[req_distinguished_name] +''') + + # Generate a certificate if one doesn't exist on disk + subprocess.check_call(['openssl', 'req', '-new', + '-newkey', 'rsa:2048', + '-days', '365', + '-nodes', '-x509', + '-subj', '/C=XX/ST=XX/L=XX/O=generated/CN=generated', + '-keyout', pem_file, + '-out', pem_file]) + # Restrict access to the file + os.chmod(pem_file, stat.S_IRUSR | stat.S_IWUSR) + c.NotebookApp.certfile = pem_file + +# Change default umask for all subprocesses of the notebook server if set in +# the environment +if 'NB_UMASK' in os.environ: + os.umask(int(os.environ['NB_UMASK'], 8)) From 6ae8512231f8420a73449b1dd99f532f518630f0 Mon Sep 17 00:00:00 2001 From: romainx Date: Wed, 30 Dec 2020 11:39:52 +0100 Subject: [PATCH 5/7] Rollback to JupyterLab 2.2x Waiting for extensions compat --- base-notebook/Dockerfile | 9 ++++- base-notebook/jupyter_server_config.py | 55 -------------------------- scipy-notebook/Dockerfile | 7 ++-- 3 files changed, 11 insertions(+), 60 deletions(-) delete mode 100644 base-notebook/jupyter_server_config.py diff --git a/base-notebook/Dockerfile b/base-notebook/Dockerfile index b140db19bd..1224ee1697 100644 --- a/base-notebook/Dockerfile +++ b/base-notebook/Dockerfile @@ -133,7 +133,7 @@ RUN wget --quiet "https://github.com/conda-forge/miniforge/releases/download/${m RUN conda install --quiet --yes \ 'notebook=6.1.6' \ 'jupyterhub=1.3.0' \ - 'jupyterlab=3.0.0' && \ + 'jupyterlab=2.2.9' && \ conda clean --all -f -y && \ npm cache clean --force && \ jupyter notebook --generate-config && \ @@ -151,10 +151,15 @@ CMD ["start-notebook.sh"] # Copy local files as late as possible to avoid cache busting COPY start.sh start-notebook.sh start-singleuser.sh /usr/local/bin/ # Need to have both files to be able to use classic and lab -COPY jupyter_notebook_config.py jupyter_server_config.py /etc/jupyter/ +COPY jupyter_notebook_config.py /etc/jupyter/ # Fix permissions on /etc/jupyter as root USER root + +# Prepare upgrade to JupyterLab V3.0 #1205 +RUN sed -re "s/c.NotebookApp/c.ServerApp/g" \ + /etc/jupyter/jupyter_notebook_config.py > /etc/jupyter/jupyter_server_config.py + RUN fix-permissions /etc/jupyter/ # Switch back to jovyan to avoid accidental container runs as root diff --git a/base-notebook/jupyter_server_config.py b/base-notebook/jupyter_server_config.py deleted file mode 100644 index 97adace485..0000000000 --- a/base-notebook/jupyter_server_config.py +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright (c) Jupyter Development Team. -# Distributed under the terms of the Modified BSD License. - -from jupyter_core.paths import jupyter_data_dir -import subprocess -import os -import errno -import stat - -c = get_config() # noqa: F821 -c.ServerApp.ip = '0.0.0.0' -c.ServerApp.port = 8888 -c.ServerApp.open_browser = False - -# https://github.com/jupyter/notebook/issues/3130 -c.FileContentsManager.delete_to_trash = False - -# Generate a self-signed certificate -if 'GEN_CERT' in os.environ: - dir_name = jupyter_data_dir() - pem_file = os.path.join(dir_name, 'notebook.pem') - try: - os.makedirs(dir_name) - except OSError as exc: # Python >2.5 - if exc.errno == errno.EEXIST and os.path.isdir(dir_name): - pass - else: - raise - - # Generate an openssl.cnf file to set the distinguished name - cnf_file = os.path.join(os.getenv('CONDA_DIR', '/usr/lib'), 'ssl', 'openssl.cnf') - if not os.path.isfile(cnf_file): - with open(cnf_file, 'w') as fh: - fh.write('''\ -[req] -distinguished_name = req_distinguished_name -[req_distinguished_name] -''') - - # Generate a certificate if one doesn't exist on disk - subprocess.check_call(['openssl', 'req', '-new', - '-newkey', 'rsa:2048', - '-days', '365', - '-nodes', '-x509', - '-subj', '/C=XX/ST=XX/L=XX/O=generated/CN=generated', - '-keyout', pem_file, - '-out', pem_file]) - # Restrict access to the file - os.chmod(pem_file, stat.S_IRUSR | stat.S_IWUSR) - c.ServerApp.certfile = pem_file - -# Change default umask for all subprocesses of the notebook server if set in -# the environment -if 'NB_UMASK' in os.environ: - os.umask(int(os.environ['NB_UMASK'], 8)) diff --git a/scipy-notebook/Dockerfile b/scipy-notebook/Dockerfile index 8be65d8979..627553d2d1 100644 --- a/scipy-notebook/Dockerfile +++ b/scipy-notebook/Dockerfile @@ -50,9 +50,10 @@ RUN conda install --quiet --yes \ jupyter nbextension enable --py widgetsnbextension --sys-prefix && \ # Also activate ipywidgets extension for JupyterLab # Check this URL for most recent compatibilities - # Not compliant with jupyterlab 3.0.x see https://github.com/bokeh/bokeh/issues/10569 - #jupyter labextension install @bokeh/jupyter_bokeh@^2.0.4 --no-build && \ - jupyter labextension install jupyter-matplotlib@^0.7.4 --no-build && \ + # https://github.com/jupyter-widgets/ipywidgets/tree/master/packages/jupyterlab-manager + jupyter labextension install @jupyter-widgets/jupyterlab-manager@^2.0.0 --no-build && \ + jupyter labextension install @bokeh/jupyter_bokeh@^2.0.0 --no-build && \ + jupyter labextension install jupyter-matplotlib@^0.7.2 --no-build && \ jupyter lab build -y && \ jupyter lab clean -y && \ npm cache clean --force && \ From 35d3fff7709912782e97325e907fbef6d3c565b5 Mon Sep 17 00:00:00 2001 From: romainx Date: Sat, 2 Jan 2021 09:31:00 +0100 Subject: [PATCH 6/7] Basic check of extension added --- scipy-notebook/test/test_extensions.py | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 scipy-notebook/test/test_extensions.py diff --git a/scipy-notebook/test/test_extensions.py b/scipy-notebook/test/test_extensions.py new file mode 100644 index 0000000000..f1e1e97383 --- /dev/null +++ b/scipy-notebook/test/test_extensions.py @@ -0,0 +1,27 @@ +# 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( + "extension", + [ + "@bokeh/jupyter_bokeh", + "@jupyter-widgets/jupyterlab-manager", + "jupyter-matplotlib", + ], +) +def test_check_extension(container, extension): + """Basic check of each extension""" + LOGGER.info(f"Checking the extension: {extension} ...") + c = container.run( + tty=True, command=["start.sh", "jupyter", "labextension", "check", extension] + ) + rv = c.wait(timeout=10) + logs = c.logs(stdout=True).decode("utf-8") + LOGGER.debug(logs) + assert rv == 0 or rv["StatusCode"] == 0, f"Extension {extension} check failed" From 628215351f806a657b8a7cf1940f1fce69ee05b1 Mon Sep 17 00:00:00 2001 From: Romain Date: Sat, 2 Jan 2021 19:31:05 +0100 Subject: [PATCH 7/7] Accept review suggestion with a best comment Co-authored-by: Peter Parente --- base-notebook/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base-notebook/Dockerfile b/base-notebook/Dockerfile index 1224ee1697..c8d3651b79 100644 --- a/base-notebook/Dockerfile +++ b/base-notebook/Dockerfile @@ -150,7 +150,7 @@ CMD ["start-notebook.sh"] # Copy local files as late as possible to avoid cache busting COPY start.sh start-notebook.sh start-singleuser.sh /usr/local/bin/ -# Need to have both files to be able to use classic and lab +# Currently need to have both jupyter_notebook_config and jupyter_server_config to support classic and lab COPY jupyter_notebook_config.py /etc/jupyter/ # Fix permissions on /etc/jupyter as root