From 1aa631870e09228d415e5dba710ff31bf4e46ba0 Mon Sep 17 00:00:00 2001 From: Abdul-Muqadim-Arbisoft Date: Mon, 30 Dec 2024 19:17:57 +0500 Subject: [PATCH 1/4] Add patch for jupyterhub and rename jupyterlab patch --- README.rst | 21 ++++++++++++++++++- ...0_185457_abdul.muqadim_jupyterhub_patch.md | 1 + .../templates/jupyter/build/hub/Dockerfile | 2 ++ .../templates/jupyter/build/lab/Dockerfile | 2 +- 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 changelog.d/20241230_185457_abdul.muqadim_jupyterhub_patch.md diff --git a/README.rst b/README.rst index bb5498f..f9d49a9 100644 --- a/README.rst +++ b/README.rst @@ -98,6 +98,25 @@ The configuration template for the JupyterHub instance is stored in `jupyterhub_ ) ) +To modify the "jupyterhub" Docker image and add extra Python packages (for example), you should create a Tutor plugin that implements the "jupyter-hub-dockerfile" patch::: + + from tutor import hooks + + hooks.Filters.ENV_PATCHES.add_item( + ( + "jupyterhub-dockerfile", + """ + # Install extra Python packages + RUN pip install jupyterhub-idle-culler + """ + ) + ) + +Then build the JupyterHub image again:: + + tutor config save + tutor images build jupyterhub + Lab environment ~~~~~~~~~~~~~~~ @@ -107,7 +126,7 @@ By default, Jupyter lab notebooks will be spawned that do not include extra Pyth hooks.Filters.ENV_PATCHES.add_item( ( - "jupyter-lab-dockerfile", + "jupyterlab-dockerfile", """ # Install extra Python packages RUN pip install matplotlib scipy seaborn diff --git a/changelog.d/20241230_185457_abdul.muqadim_jupyterhub_patch.md b/changelog.d/20241230_185457_abdul.muqadim_jupyterhub_patch.md new file mode 100644 index 0000000..da22b0a --- /dev/null +++ b/changelog.d/20241230_185457_abdul.muqadim_jupyterhub_patch.md @@ -0,0 +1 @@ +- [Feature] Add `jupyterhub-dockerfile` patch to JupyterHub Dockerfile for customization. (by @Abdul-Muqadim-Arbisoft) \ No newline at end of file diff --git a/tutorjupyter/templates/jupyter/build/hub/Dockerfile b/tutorjupyter/templates/jupyter/build/hub/Dockerfile index 20c4380..cc24004 100644 --- a/tutorjupyter/templates/jupyter/build/hub/Dockerfile +++ b/tutorjupyter/templates/jupyter/build/hub/Dockerfile @@ -12,4 +12,6 @@ RUN pip install \ jupyterhub-ltiauthenticator==1.6.1 \ pymysql==1.1.0 +{{ patch("jupyterhub-dockerfile") }} + CMD ["jupyterhub"] diff --git a/tutorjupyter/templates/jupyter/build/lab/Dockerfile b/tutorjupyter/templates/jupyter/build/lab/Dockerfile index b2e771b..4ade123 100644 --- a/tutorjupyter/templates/jupyter/build/lab/Dockerfile +++ b/tutorjupyter/templates/jupyter/build/lab/Dockerfile @@ -16,7 +16,7 @@ RUN pip install nbgitpuller==1.2.0 # https://pypi.org/project/jupyterlab/ RUN pip install jupyterlab==4.0.9 -{{ patch("jupyter-lab-dockerfile") }} +{{ patch("jupyterlab-dockerfile") }} # Disable obnoxious jupyterlab announcements # https://jupyterlab.readthedocs.io/en/stable/user/announcements.html From 92c7a5a680b35abead2b28c8eb0799b59a9b97d8 Mon Sep 17 00:00:00 2001 From: Abdul-Muqadim-Arbisoft Date: Tue, 31 Dec 2024 11:59:47 +0500 Subject: [PATCH 2/4] readme corrections --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index f9d49a9..adfc6bc 100644 --- a/README.rst +++ b/README.rst @@ -98,7 +98,7 @@ The configuration template for the JupyterHub instance is stored in `jupyterhub_ ) ) -To modify the "jupyterhub" Docker image and add extra Python packages (for example), you should create a Tutor plugin that implements the "jupyter-hub-dockerfile" patch::: +To modify the "jupyterhub" Docker image and add extra Python packages (for example), you should create a Tutor plugin that implements the "jupyterhub-dockerfile" patch::: from tutor import hooks @@ -120,7 +120,7 @@ Then build the JupyterHub image again:: Lab environment ~~~~~~~~~~~~~~~ -By default, Jupyter lab notebooks will be spawned that do not include extra Python packages or dependencies. To modify the "jupyterlab" Docker image and add extra Python packages (for example), you should create a Tutor plugin that implements the "jupyter-lab-dockerfile" patch:: +By default, Jupyter lab notebooks will be spawned that do not include extra Python packages or dependencies. To modify the "jupyterlab" Docker image and add extra Python packages (for example), you should create a Tutor plugin that implements the "jupyterlab-dockerfile" patch:: from tutor import hooks From 0a2bf4e08bad27789bd86604dc423cd428415e24 Mon Sep 17 00:00:00 2001 From: Abdul-Muqadim-Arbisoft Date: Thu, 2 Jan 2025 12:40:40 +0500 Subject: [PATCH 3/4] changing changelog entry --- changelog.d/20241230_185457_abdul.muqadim_jupyterhub_patch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/20241230_185457_abdul.muqadim_jupyterhub_patch.md b/changelog.d/20241230_185457_abdul.muqadim_jupyterhub_patch.md index da22b0a..ae3f902 100644 --- a/changelog.d/20241230_185457_abdul.muqadim_jupyterhub_patch.md +++ b/changelog.d/20241230_185457_abdul.muqadim_jupyterhub_patch.md @@ -1 +1 @@ -- [Feature] Add `jupyterhub-dockerfile` patch to JupyterHub Dockerfile for customization. (by @Abdul-Muqadim-Arbisoft) \ No newline at end of file +- 💥[Feature] Renamed the `jupyter-lab-dockerfile` to `jupyterlab-dockerfile` for consistency across the Tutor ecosystem and added the `jupyterhub-dockerfile` patch to the JupyterHub Dockerfile for customization. If you were previously using the patch with the old name, update your configuration to reflect the new name to ensure compatibility. (by @Abdul-Muqadim-Arbisoft) From 0bd5593f5ecf0adeac19ab726062d6de638957e7 Mon Sep 17 00:00:00 2001 From: Abdul-Muqadim-Arbisoft Date: Mon, 6 Jan 2025 10:54:10 +0500 Subject: [PATCH 4/4] adjusting readme --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index adfc6bc..5acc8ea 100644 --- a/README.rst +++ b/README.rst @@ -98,7 +98,7 @@ The configuration template for the JupyterHub instance is stored in `jupyterhub_ ) ) -To modify the "jupyterhub" Docker image and add extra Python packages (for example), you should create a Tutor plugin that implements the "jupyterhub-dockerfile" patch::: +To modify the "jupyterhub" Docker image and add extra Python packages (for example), you should create a Tutor plugin that implements the "jupyterhub-dockerfile" patch:: from tutor import hooks