From 81be7f20dd35e8868b5db0d0fcf5233ad62e4e9e Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Tue, 2 Jan 2024 11:28:26 -0800 Subject: [PATCH 1/6] Add jupyter-resource-usage extension, jupyter_server_config.py, .gitconfig, pin pexpect to 4.9.0 --- docker/r-dsci-100/.gitconfig | 2 + docker/r-dsci-100/Dockerfile | 11 ++++- docker/r-dsci-100/jupyter_server_config.py | 49 ++++++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 docker/r-dsci-100/.gitconfig create mode 100644 docker/r-dsci-100/jupyter_server_config.py diff --git a/docker/r-dsci-100/.gitconfig b/docker/r-dsci-100/.gitconfig new file mode 100644 index 0000000..714a222 --- /dev/null +++ b/docker/r-dsci-100/.gitconfig @@ -0,0 +1,2 @@ +[pull] + rebase = true \ No newline at end of file diff --git a/docker/r-dsci-100/Dockerfile b/docker/r-dsci-100/Dockerfile index ea40ef5..65526d2 100644 --- a/docker/r-dsci-100/Dockerfile +++ b/docker/r-dsci-100/Dockerfile @@ -24,6 +24,7 @@ RUN mamba install --quiet --yes \ 'r-kknn' \ 'r-testthat' \ 'r-rpostgres' \ + 'jupyter-resource-usage' \ && mamba clean --all -f -y \ && fix-permissions "${CONDA_DIR}" \ && fix-permissions "/home/${NB_USER}" \ @@ -32,8 +33,8 @@ RUN mamba install --quiet --yes \ && Rscript -e "install.packages('tidyclust', repos='http://cran.us.r-project.org')" \ && Rscript -e "install.packages('janitor', repos='http://cran.us.r-project.org')" -# Install nbgitpuller, jlab-git -RUN pip install nbgitpuller jupyterlab-git \ +# Install nbgitpuller, jlab-git, newest pexpect 4.9.0 +RUN pip install nbgitpuller jupyterlab-git pexpect==4.9.0 \ && jupyter lab build # Disable the cell toolbar (which ignores metadata and students often accidentally click + delete grading cells) @@ -42,6 +43,12 @@ RUN jupyter labextension disable @jupyterlab/cell-toolbar-extension # Install the extension to remove the shift+M merge shortcut COPY shortcuts.jupyterlab-settings /home/${NB_USER}/.jupyter/lab/user-settings/\@jupyterlab/shortcuts-extension/shortcuts.jupyterlab-settings +# Copy jupyter_server_config.py which allows students to see and delete hidden files +COPY jupyter_server_config.py /home/${NB_USER}/.jupyter + +# Copy gitconfig that sets global default pull strategy to rebase +COPY .gitconfig /home/${NB_USER}/ + # Make sure everything in the home folder is owned by NB_USER USER root RUN chown -R ${NB_USER} /home/${NB_USER} diff --git a/docker/r-dsci-100/jupyter_server_config.py b/docker/r-dsci-100/jupyter_server_config.py new file mode 100644 index 0000000..40ad408 --- /dev/null +++ b/docker/r-dsci-100/jupyter_server_config.py @@ -0,0 +1,49 @@ +# Configuration file for jupyter-server. + +c = get_config() #noqa + +#------------------------------------------------------------------------------ +# ContentsManager(LoggingConfigurable) configuration +#------------------------------------------------------------------------------ +## Base class for serving files and directories. +# +# This serves any text or binary file, +# as well as directories, +# with special handling for JSON notebook documents. +# +# Most APIs take a path argument, +# which is always an API-style unicode path, +# and always refers to a directory. +# +# - unicode, not url-escaped +# - '/'-separated +# - leading and trailing '/' will be stripped +# - if unspecified, path defaults to '', +# indicating the root path. + +## Allow access to hidden files +# Default: False +c.ContentsManager.allow_hidden = True + +#------------------------------------------------------------------------------ +# FileContentsManager(FileManagerMixin, ContentsManager) configuration +#------------------------------------------------------------------------------ +## Allow access to hidden files +# See also: ContentsManager.allow_hidden +c.FileContentsManager.allow_hidden = True + +#------------------------------------------------------------------------------ +# AsyncContentsManager(ContentsManager) configuration +#------------------------------------------------------------------------------ +## Base class for serving files and directories asynchronously. + +## Allow access to hidden files +# See also: ContentsManager.allow_hidden +c.AsyncContentsManager.allow_hidden = True + +#------------------------------------------------------------------------------ +# AsyncFileContentsManager(FileContentsManager, AsyncFileManagerMixin, AsyncContentsManager) configuration +#------------------------------------------------------------------------------ +## Allow access to hidden files +# See also: ContentsManager.allow_hidden +c.AsyncFileContentsManager.allow_hidden = True From 4f83b5262c23c9d8e8bd0237696845ccd4151e49 Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Tue, 2 Jan 2024 12:37:47 -0800 Subject: [PATCH 2/6] Add jupyter-resource-usage extension, jupyter_server_config.py, .gitconfig, pexpect for python image --- docker/py-dsci-100/.gitconfig | 2 + docker/py-dsci-100/Dockerfile | 16 ++++--- docker/py-dsci-100/jupyter_server_config.py | 49 +++++++++++++++++++++ 3 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 docker/py-dsci-100/.gitconfig create mode 100644 docker/py-dsci-100/jupyter_server_config.py diff --git a/docker/py-dsci-100/.gitconfig b/docker/py-dsci-100/.gitconfig new file mode 100644 index 0000000..714a222 --- /dev/null +++ b/docker/py-dsci-100/.gitconfig @@ -0,0 +1,2 @@ +[pull] + rebase = true \ No newline at end of file diff --git a/docker/py-dsci-100/Dockerfile b/docker/py-dsci-100/Dockerfile index d018c32..65c1412 100644 --- a/docker/py-dsci-100/Dockerfile +++ b/docker/py-dsci-100/Dockerfile @@ -15,11 +15,6 @@ WORKDIR "${HOME}/work" # https://discourse.jupyter.org/t/debugger-warning-it-seems-that-frozen-modules-are-being-used-python-3-11-0/16544/12 ENV PYDEVD_DISABLE_FILE_VALIDATION=1 -# update scikit-learn to the current @main (July 20, 2023) -# to get this merged PR: https://github.com/scikit-learn/scikit-learn/pull/26772 -# which fixes this issue: https://github.com/scikit-learn/scikit-learn/issues/26768 -RUN pip install --upgrade git+https://github.com/scikit-learn/scikit-learn@7de59b2017f39048880a3858d32c8caef9308954 - # Install Python packages RUN mamba install --quiet --yes \ 'numpy' \ @@ -29,6 +24,7 @@ RUN mamba install --quiet --yes \ 'ibis-framework' \ 'nodejs' \ 'psycopg2' \ + 'jupyter-resource-usage' \ && mamba clean --all -f -y \ && fix-permissions "${CONDA_DIR}" \ && fix-permissions "/home/${NB_USER}" @@ -36,8 +32,8 @@ RUN mamba install --quiet --yes \ # Install some recent python package that might not be on conda yet RUN pip install pandas"<2.1" altair"==5.0.1" "vegafusion[embed]" vl-convert-python -# Install nbgitpuller, jlab-git -RUN pip install nbgitpuller jupyterlab-git \ +# Install nbgitpuller, jlab-git, newest pexpect 4.9.0 +RUN pip install nbgitpuller jupyterlab-git==0.50.0 pexpect==4.9.0 \ && jupyter lab build # Disable the cell toolbar (which ignores metadata and students often accidentally click + delete grading cells) @@ -46,6 +42,12 @@ RUN jupyter labextension disable @jupyterlab/cell-toolbar-extension # Install the extension to remove the shift+M merge shortcut COPY shortcuts.jupyterlab-settings /home/${NB_USER}/.jupyter/lab/user-settings/\@jupyterlab/shortcuts-extension/shortcuts.jupyterlab-settings +# Copy jupyter_server_config.py which allows students to see and delete hidden files +COPY jupyter_server_config.py /home/${NB_USER}/.jupyter + +# Copy gitconfig that sets global default pull strategy to rebase +COPY .gitconfig /home/${NB_USER}/ + # Make sure everything in the home folder is owned by NB_USER USER root RUN chown -R ${NB_USER} /home/${NB_USER} diff --git a/docker/py-dsci-100/jupyter_server_config.py b/docker/py-dsci-100/jupyter_server_config.py new file mode 100644 index 0000000..40ad408 --- /dev/null +++ b/docker/py-dsci-100/jupyter_server_config.py @@ -0,0 +1,49 @@ +# Configuration file for jupyter-server. + +c = get_config() #noqa + +#------------------------------------------------------------------------------ +# ContentsManager(LoggingConfigurable) configuration +#------------------------------------------------------------------------------ +## Base class for serving files and directories. +# +# This serves any text or binary file, +# as well as directories, +# with special handling for JSON notebook documents. +# +# Most APIs take a path argument, +# which is always an API-style unicode path, +# and always refers to a directory. +# +# - unicode, not url-escaped +# - '/'-separated +# - leading and trailing '/' will be stripped +# - if unspecified, path defaults to '', +# indicating the root path. + +## Allow access to hidden files +# Default: False +c.ContentsManager.allow_hidden = True + +#------------------------------------------------------------------------------ +# FileContentsManager(FileManagerMixin, ContentsManager) configuration +#------------------------------------------------------------------------------ +## Allow access to hidden files +# See also: ContentsManager.allow_hidden +c.FileContentsManager.allow_hidden = True + +#------------------------------------------------------------------------------ +# AsyncContentsManager(ContentsManager) configuration +#------------------------------------------------------------------------------ +## Base class for serving files and directories asynchronously. + +## Allow access to hidden files +# See also: ContentsManager.allow_hidden +c.AsyncContentsManager.allow_hidden = True + +#------------------------------------------------------------------------------ +# AsyncFileContentsManager(FileContentsManager, AsyncFileManagerMixin, AsyncContentsManager) configuration +#------------------------------------------------------------------------------ +## Allow access to hidden files +# See also: ContentsManager.allow_hidden +c.AsyncFileContentsManager.allow_hidden = True From df1e39fb1cae69ad441b98cb8cbddbca8da62502 Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Tue, 2 Jan 2024 13:00:57 -0800 Subject: [PATCH 3/6] Add zip package --- docker/py-dsci-100/Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/py-dsci-100/Dockerfile b/docker/py-dsci-100/Dockerfile index 65c1412..4164c72 100644 --- a/docker/py-dsci-100/Dockerfile +++ b/docker/py-dsci-100/Dockerfile @@ -48,7 +48,11 @@ COPY jupyter_server_config.py /home/${NB_USER}/.jupyter # Copy gitconfig that sets global default pull strategy to rebase COPY .gitconfig /home/${NB_USER}/ -# Make sure everything in the home folder is owned by NB_USER USER root +# Install zip package +RUN apt install zip + +# Make sure everything in the home folder is owned by NB_USER RUN chown -R ${NB_USER} /home/${NB_USER} -USER ${NB_UID} + +USER ${NB_UID} \ No newline at end of file From f2a389319ffc0743de8b8268cb7feadd4b8a7ff1 Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Tue, 2 Jan 2024 13:42:56 -0800 Subject: [PATCH 4/6] Disable healthcheck --- docker/py-dsci-100/Dockerfile | 5 ++++- docker/r-dsci-100/Dockerfile | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docker/py-dsci-100/Dockerfile b/docker/py-dsci-100/Dockerfile index 4164c72..43e7e77 100644 --- a/docker/py-dsci-100/Dockerfile +++ b/docker/py-dsci-100/Dockerfile @@ -55,4 +55,7 @@ RUN apt install zip # Make sure everything in the home folder is owned by NB_USER RUN chown -R ${NB_USER} /home/${NB_USER} -USER ${NB_UID} \ No newline at end of file +USER ${NB_UID} + +#Disable healthcheck for performance reasons +HEALTHCHECK NONE \ No newline at end of file diff --git a/docker/r-dsci-100/Dockerfile b/docker/r-dsci-100/Dockerfile index 65526d2..62c98f7 100644 --- a/docker/r-dsci-100/Dockerfile +++ b/docker/r-dsci-100/Dockerfile @@ -54,3 +54,5 @@ USER root RUN chown -R ${NB_USER} /home/${NB_USER} USER ${NB_UID} +# Disable healthcheck for performance reasons +HEALTHCHECK NONE \ No newline at end of file From c0e7251039996000694eff0dce66343f639a5486 Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Wed, 3 Jan 2024 10:39:32 -0800 Subject: [PATCH 5/6] Change pull strategy to merge, update comments --- docker/r-dsci-100/.gitconfig | 2 +- docker/r-dsci-100/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/r-dsci-100/.gitconfig b/docker/r-dsci-100/.gitconfig index 714a222..713f029 100644 --- a/docker/r-dsci-100/.gitconfig +++ b/docker/r-dsci-100/.gitconfig @@ -1,2 +1,2 @@ [pull] - rebase = true \ No newline at end of file + rebase = false \ No newline at end of file diff --git a/docker/r-dsci-100/Dockerfile b/docker/r-dsci-100/Dockerfile index 62c98f7..b103660 100644 --- a/docker/r-dsci-100/Dockerfile +++ b/docker/r-dsci-100/Dockerfile @@ -46,7 +46,7 @@ COPY shortcuts.jupyterlab-settings /home/${NB_USER}/.jupyter/lab/user-settings/\ # Copy jupyter_server_config.py which allows students to see and delete hidden files COPY jupyter_server_config.py /home/${NB_USER}/.jupyter -# Copy gitconfig that sets global default pull strategy to rebase +# Copy gitconfig that sets global default pull strategy to merge COPY .gitconfig /home/${NB_USER}/ # Make sure everything in the home folder is owned by NB_USER From c49212b319647179b58b7f74adb7376f5502c7bd Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Wed, 3 Jan 2024 10:40:00 -0800 Subject: [PATCH 6/6] Change pull strategy to merge in Python image, update comments --- docker/py-dsci-100/.gitconfig | 2 +- docker/py-dsci-100/Dockerfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/py-dsci-100/.gitconfig b/docker/py-dsci-100/.gitconfig index 714a222..713f029 100644 --- a/docker/py-dsci-100/.gitconfig +++ b/docker/py-dsci-100/.gitconfig @@ -1,2 +1,2 @@ [pull] - rebase = true \ No newline at end of file + rebase = false \ No newline at end of file diff --git a/docker/py-dsci-100/Dockerfile b/docker/py-dsci-100/Dockerfile index 43e7e77..106c7f8 100644 --- a/docker/py-dsci-100/Dockerfile +++ b/docker/py-dsci-100/Dockerfile @@ -45,7 +45,7 @@ COPY shortcuts.jupyterlab-settings /home/${NB_USER}/.jupyter/lab/user-settings/\ # Copy jupyter_server_config.py which allows students to see and delete hidden files COPY jupyter_server_config.py /home/${NB_USER}/.jupyter -# Copy gitconfig that sets global default pull strategy to rebase +# Copy gitconfig that sets global default pull strategy to merge COPY .gitconfig /home/${NB_USER}/ USER root @@ -57,5 +57,5 @@ RUN chown -R ${NB_USER} /home/${NB_USER} USER ${NB_UID} -#Disable healthcheck for performance reasons +# Disable healthcheck for performance reasons HEALTHCHECK NONE \ No newline at end of file