From 71cb01160124fa2fe56629195e472d053c09ba5b Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Tue, 13 May 2025 11:13:37 -0700 Subject: [PATCH 1/9] Apply JupyterLab overrides on binder. --- .binder/postBuild | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .binder/postBuild diff --git a/.binder/postBuild b/.binder/postBuild new file mode 100644 index 0000000..24d1495 --- /dev/null +++ b/.binder/postBuild @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -eux + +mkdir -p ${NB_PYTHON_PREFIX}/share/jupyter/lab/settings +cp jupyterlab_config.json ${NB_PYTHON_PREFIX}/share/jupyter/lab/settings/overrides.json From 6a0b925f6d81d47db0b2de8b0ffe77bd69c9bb7d Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Tue, 13 May 2025 11:15:55 -0700 Subject: [PATCH 2/9] Add Binder link. --- conf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conf.py b/conf.py index 58652c2..daa0dae 100644 --- a/conf.py +++ b/conf.py @@ -53,4 +53,7 @@ "use_repository_button": True, "use_issues_button": True, "use_edit_page_button": True, + "launch_buttons": { + "binderhub_url": "https://mybinder.org/v2/gh/scientific-python/executable-tutorials/HEAD?urlpath=%2Fdoc%2Ftree%2Ftutorials" + }, } From e03a82f255293ffc57d73a459b8f2a867c15a60a Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Tue, 13 May 2025 11:20:24 -0700 Subject: [PATCH 3/9] binderhub_url expect root or binder instance --- conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.py b/conf.py index daa0dae..bcb13b2 100644 --- a/conf.py +++ b/conf.py @@ -54,6 +54,6 @@ "use_issues_button": True, "use_edit_page_button": True, "launch_buttons": { - "binderhub_url": "https://mybinder.org/v2/gh/scientific-python/executable-tutorials/HEAD?urlpath=%2Fdoc%2Ftree%2Ftutorials" + "binderhub_url": "https://mybinder.org" }, } From 07d7463f5c1c80a13e23056340d2ca98be84bb56 Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Tue, 13 May 2025 11:30:15 -0700 Subject: [PATCH 4/9] Keep just one copy of the double-click workaround. --- .binder/postBuild | 2 +- jupyterlab_config.json => overrides.json | 0 pixi.toml | 5 ++++- setup_jupyterlab_config.sh | 5 ----- 4 files changed, 5 insertions(+), 7 deletions(-) mode change 100644 => 100755 .binder/postBuild rename jupyterlab_config.json => overrides.json (100%) delete mode 100644 setup_jupyterlab_config.sh diff --git a/.binder/postBuild b/.binder/postBuild old mode 100644 new mode 100755 index 24d1495..42123ee --- a/.binder/postBuild +++ b/.binder/postBuild @@ -2,4 +2,4 @@ set -eux mkdir -p ${NB_PYTHON_PREFIX}/share/jupyter/lab/settings -cp jupyterlab_config.json ${NB_PYTHON_PREFIX}/share/jupyter/lab/settings/overrides.json +cp overrides.json ${NB_PYTHON_PREFIX}/share/jupyter/lab/settings/overrides.json diff --git a/jupyterlab_config.json b/overrides.json similarity index 100% rename from jupyterlab_config.json rename to overrides.json diff --git a/pixi.toml b/pixi.toml index c83a7bb..b188d78 100644 --- a/pixi.toml +++ b/pixi.toml @@ -26,7 +26,10 @@ start = "jupyter lab" test = "bash ./test.sh" [activation] -scripts = ["setup_jupyterlab_config.sh"] +# Workaround overrides JupyterLab configuration (at the environment level) to +# make double-clicking on a Jupytext Markdown file open that file as a +# notebook. This is important for the development workflow for contributors. +scripts = ["bash .binder/postBuild"] [dependencies] python = ">=3.11" diff --git a/setup_jupyterlab_config.sh b/setup_jupyterlab_config.sh deleted file mode 100644 index a721234..0000000 --- a/setup_jupyterlab_config.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -set -eux - -mkdir -p ${CONDA_PREFIX}/share/jupyter/lab/settings -cp jupyterlab_config.json ${CONDA_PREFIX}/share/jupyter/lab/settings/overrides.json From 4d5b60c5982c13d9adddb66c0a31cf14559263b6 Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Tue, 13 May 2025 11:50:17 -0700 Subject: [PATCH 5/9] Move overrides.json in .binder/ --- overrides.json => .binder/overrides.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename overrides.json => .binder/overrides.json (100%) diff --git a/overrides.json b/.binder/overrides.json similarity index 100% rename from overrides.json rename to .binder/overrides.json From bf16cf6068ea216a0f49c67afce42f7ed1135265 Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Tue, 13 May 2025 11:52:05 -0700 Subject: [PATCH 6/9] Fix path --- .binder/postBuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.binder/postBuild b/.binder/postBuild index 42123ee..c995aa1 100755 --- a/.binder/postBuild +++ b/.binder/postBuild @@ -2,4 +2,4 @@ set -eux mkdir -p ${NB_PYTHON_PREFIX}/share/jupyter/lab/settings -cp overrides.json ${NB_PYTHON_PREFIX}/share/jupyter/lab/settings/overrides.json +cp .binder/overrides.json ${NB_PYTHON_PREFIX}/share/jupyter/lab/settings/overrides.json From a44e2bdaa5314e42ac570522379e4b5972f21bea Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Tue, 13 May 2025 11:55:44 -0700 Subject: [PATCH 7/9] Add jupyterlab-myst to requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index a1e6cc1..6c58584 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,3 +11,4 @@ pytest nbval pytest-custom_exit_code jupytext +jupyterlab-myst From 89ccf953343f6e5693bf1ee524215e97768e640d Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Tue, 13 May 2025 13:00:35 -0700 Subject: [PATCH 8/9] Add binder requirements. --- .binder/requirements.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .binder/requirements.txt diff --git a/.binder/requirements.txt b/.binder/requirements.txt new file mode 100644 index 0000000..6dd0505 --- /dev/null +++ b/.binder/requirements.txt @@ -0,0 +1,4 @@ +ipympl +jupyterlab-myst +jupytext +matplotlib From 50420a525cd73bc99a64ff18276d0d2d91be8424 Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Tue, 13 May 2025 13:02:29 -0700 Subject: [PATCH 9/9] Pass requirements via reference. --- .binder/requirements.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.binder/requirements.txt b/.binder/requirements.txt index 6dd0505..3c8d7e7 100644 --- a/.binder/requirements.txt +++ b/.binder/requirements.txt @@ -1,4 +1 @@ -ipympl -jupyterlab-myst -jupytext -matplotlib +-r ../requirements.txt