From 5bcb0b62a3fe3cec47d540e38eb02ff417cdb07a Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Wed, 14 May 2025 14:55:39 -0700 Subject: [PATCH 01/18] Explain how to launch executable tutorials. --- index.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.md b/index.md index cd34eab..84a53a4 100644 --- a/index.md +++ b/index.md @@ -25,8 +25,13 @@ launch JupyterLab. git clone https://github.com/scientific-python/executable-tutorials cd executable-tutorials +<<<<<<< HEAD python -m venv .venv source .venv/bin/activate +======= +python -m venv venv +source venv/bin/activate +>>>>>>> d8cca2b (Explain how to launch executable tutorials.) pip install -r requirements.txt jupyter lab From d794c80f18ad6c18047c0a249875603f93b86804 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 14 May 2025 17:02:08 -0500 Subject: [PATCH 02/18] WIP: enable jupyterlite pixi tasks --- .gitignore | 3 +++ environment.yml | 13 +++++++++++ pixi.toml | 59 +++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 environment.yml diff --git a/.gitignore b/.gitignore index 6154ca0..a452f66 100644 --- a/.gitignore +++ b/.gitignore @@ -95,6 +95,9 @@ target/ # Jupyter Notebook .ipynb_checkpoints +# Jupyterlite Database +.jupyterlite.doit.db + # IPython profile_default/ ipython_config.py diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..c44d8ea --- /dev/null +++ b/environment.yml @@ -0,0 +1,13 @@ +name: xeus-kernels +channels: + - https://repo.mamba.pm/emscripten-forge + - conda-forge +dependencies: + - xeus-python + - xeus-lua + - xeus-nelson + - numpy + - matplotlib + - pillow + - ipywidgets + - ipympl diff --git a/pixi.toml b/pixi.toml index 528ef42..c78a97e 100644 --- a/pixi.toml +++ b/pixi.toml @@ -5,10 +5,10 @@ authors = [ "Ross Barnowski ", "Kyle Sunden ", ] -channels = ["conda-forge"] +channels = ["https://repo.mamba.pm/emscripten-forge", "conda-forge"] description = "Add a short description here" name = "executable-tutorials" -platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"] +platforms = ["linux-64", "osx-64", "osx-arm64", "win-64", "emscripten-wasm32"] version = "0.1.0" [tasks] @@ -34,11 +34,11 @@ scripts = ["bash .binder/postBuild"] [dependencies] python = ">=3.11" matplotlib-base = ">=3.9" -ipympl = ">=0.9" -jupyterlab = ">=4.2" -jupyterlab-myst = ">=2.4" +#jupyterlab = ">=4.2" +#jupyterlab-myst = ">=2.4" pytest = ">=8.3.5,<9" -nbval = ">=0.11.0,<0.12" +#nbval = ">=0.11.0,<0.12" +#jupytext = ">=1.17.1,<2" [pypi-dependencies] sphinx = ">=8.0.2" @@ -48,20 +48,61 @@ sphinx-book-theme = ">=1.1" sphinx-copybutton = ">=0.5" sphinx-design = "*" pytest-custom_exit_code = "*" +#sphinx = ">=8.0.2" +#myst-nb = ">=1.1" +#jupytext = ">=1.16" +#sphinx-book-theme = ">=1.1" +#sphinx-copybutton = ">=0.5" + +[feature.py312] +platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"] [feature.py312.dependencies] python = "3.12.*" +[feature.py313] +platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"] + [feature.py313.dependencies] python = "3.13.*" -[feature.jupyterlite.dependencies] +[feature.jupyterlite-runtime] +channels = ["https://repo.mamba.pm/emscripten-forge", "conda-forge"] +platforms = ["emscripten-wasm32"] + +[feature.jupyterlite-runtime.dependencies] +xeus-python = "*" +python = "*" +matplotlib = "*" +ipympl = "*" +jupytext = "*" + +[feature.jupyterlite-host] +channels = ["conda-forge"] +platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"] + +[feature.jupyterlite-host.dependencies] jupyterlab = "~=4.2.4" jupyterlite-core = "==0.4.0" -jupyterlite-pyodide-kernel = "==0.4.1" +jupyterlite-xeus = "*" notebook = "~=7.2.1" +jupyterlab-myst = ">=2.4" + +[feature.jupyterlite-host.tasks] +setup_wasm = {cmd = "pixi install -e jupyterlite-runtime", inputs = ["pixi.lock"]} + +[feature.jupyterlite-host.tasks.build_wasm] +cmd = "jupyter lite build --XeusAddon.prefix=.pixi/envs/jupyterlite-runtime --contents tutorials --output-dir build/html/jupyterlite --settings-overrides=jupyterlab_config.json --log-level DEBUG" +depends-on = ["setup_wasm"] +outputs = ["build/html/jupyterlite/"] +inputs = ["pixi.lock", "tutorials/"] + +[feature.jupyterlite-host.tasks.start_wasm] +cmd = "python -m http.server 8000 -d build/html/jupyterlite/" +depends-on = ["build_wasm"] [environments] py312 = ["py312"] py313 = ["py313"] -jupyterlite = ["jupyterlite"] +jupyterlite-runtime = ["jupyterlite-runtime"] +jupyterlite-host = ["jupyterlite-host"] From a83ac3fc4239daaea89417f24d8af6b43fd1ce17 Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Wed, 14 May 2025 15:05:40 -0700 Subject: [PATCH 03/18] Nuke environment.yml, not needed --- environment.yml | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 environment.yml diff --git a/environment.yml b/environment.yml deleted file mode 100644 index c44d8ea..0000000 --- a/environment.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: xeus-kernels -channels: - - https://repo.mamba.pm/emscripten-forge - - conda-forge -dependencies: - - xeus-python - - xeus-lua - - xeus-nelson - - numpy - - matplotlib - - pillow - - ipywidgets - - ipympl From c936f0f5e86473978fc48117b0e191233fef8c29 Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Wed, 14 May 2025 15:09:11 -0700 Subject: [PATCH 04/18] Fix rebase mistake --- pixi.toml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pixi.toml b/pixi.toml index c78a97e..4a4eb72 100644 --- a/pixi.toml +++ b/pixi.toml @@ -41,18 +41,13 @@ pytest = ">=8.3.5,<9" #jupytext = ">=1.17.1,<2" [pypi-dependencies] -sphinx = ">=8.0.2" -myst-nb = ">=1.1" -jupytext = ">=1.16" -sphinx-book-theme = ">=1.1" -sphinx-copybutton = ">=0.5" -sphinx-design = "*" -pytest-custom_exit_code = "*" #sphinx = ">=8.0.2" #myst-nb = ">=1.1" #jupytext = ">=1.16" #sphinx-book-theme = ">=1.1" #sphinx-copybutton = ">=0.5" +#sphinx-design = "*" +#pytest-custom_exit_code = "*" [feature.py312] platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"] From c640a926cb31b17c5c2682aa33896925fdda073d Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Wed, 14 May 2025 15:09:17 -0700 Subject: [PATCH 05/18] Update path to jupyterlab settings overrides. --- pixi.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pixi.toml b/pixi.toml index 4a4eb72..5cdbe44 100644 --- a/pixi.toml +++ b/pixi.toml @@ -87,7 +87,7 @@ jupyterlab-myst = ">=2.4" setup_wasm = {cmd = "pixi install -e jupyterlite-runtime", inputs = ["pixi.lock"]} [feature.jupyterlite-host.tasks.build_wasm] -cmd = "jupyter lite build --XeusAddon.prefix=.pixi/envs/jupyterlite-runtime --contents tutorials --output-dir build/html/jupyterlite --settings-overrides=jupyterlab_config.json --log-level DEBUG" +cmd = "jupyter lite build --XeusAddon.prefix=.pixi/envs/jupyterlite-runtime --contents tutorials --output-dir build/html/jupyterlite --settings-overrides=.binder/overrides.json --log-level DEBUG" depends-on = ["setup_wasm"] outputs = ["build/html/jupyterlite/"] inputs = ["pixi.lock", "tutorials/"] From 654925b1711bc75fda35781b88ce1ef0ef9880f9 Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Wed, 14 May 2025 15:12:20 -0700 Subject: [PATCH 06/18] build -> _build --- pixi.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pixi.toml b/pixi.toml index 5cdbe44..bb6a90d 100644 --- a/pixi.toml +++ b/pixi.toml @@ -87,13 +87,13 @@ jupyterlab-myst = ">=2.4" setup_wasm = {cmd = "pixi install -e jupyterlite-runtime", inputs = ["pixi.lock"]} [feature.jupyterlite-host.tasks.build_wasm] -cmd = "jupyter lite build --XeusAddon.prefix=.pixi/envs/jupyterlite-runtime --contents tutorials --output-dir build/html/jupyterlite --settings-overrides=.binder/overrides.json --log-level DEBUG" +cmd = "jupyter lite build --XeusAddon.prefix=.pixi/envs/jupyterlite-runtime --contents tutorials --output-dir _build/html/jupyterlite --settings-overrides=.binder/overrides.json --log-level DEBUG" depends-on = ["setup_wasm"] -outputs = ["build/html/jupyterlite/"] +outputs = ["_build/html/jupyterlite/"] inputs = ["pixi.lock", "tutorials/"] [feature.jupyterlite-host.tasks.start_wasm] -cmd = "python -m http.server 8000 -d build/html/jupyterlite/" +cmd = "python -m http.server 8000 -d _build/html/jupyterlite/" depends-on = ["build_wasm"] [environments] From 16ea2330010b8c82bc75aab7c91194271b57081b Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Wed, 14 May 2025 15:23:29 -0700 Subject: [PATCH 07/18] Give absolute path to activation script. --- pixi.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pixi.toml b/pixi.toml index bb6a90d..55a9b69 100644 --- a/pixi.toml +++ b/pixi.toml @@ -29,7 +29,7 @@ test = "bash ./test.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"] +scripts = ["bash $PIXI_PROJECT_ROOT/.binder/postBuild"] [dependencies] python = ">=3.11" From 9871c42f820a772e093d96aebd33385ae036b7a7 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 14 May 2025 17:58:24 -0500 Subject: [PATCH 08/18] Fix env var for PIXI_PROJECT_ROOT --- pixi.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pixi.toml b/pixi.toml index 55a9b69..1328a31 100644 --- a/pixi.toml +++ b/pixi.toml @@ -29,7 +29,7 @@ test = "bash ./test.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 $PIXI_PROJECT_ROOT/.binder/postBuild"] +scripts = ["bash {$PIXI_PROJECT_ROOT}/.binder/postBuild"] [dependencies] python = ">=3.11" From b5d5e05cfc0be176a6724455f51a594535357d16 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 14 May 2025 18:07:25 -0500 Subject: [PATCH 09/18] Reorganize base environment into feature --- pixi.toml | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/pixi.toml b/pixi.toml index 1328a31..09115a1 100644 --- a/pixi.toml +++ b/pixi.toml @@ -11,7 +11,10 @@ name = "executable-tutorials" platforms = ["linux-64", "osx-64", "osx-arm64", "win-64", "emscripten-wasm32"] version = "0.1.0" -[tasks] +[feature.base] +platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"] + +[feature.base.tasks] build = { cmd = [ "sphinx-build", ".", # source directory @@ -25,29 +28,30 @@ clean = "rm -rf _build/*" start = "jupyter lab --FileContentsManager.preferred_dir tutorials" test = "bash ./test.sh" -[activation] +[feature.base.activation] # 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 {$PIXI_PROJECT_ROOT}/.binder/postBuild"] -[dependencies] +[feature.base.dependencies] python = ">=3.11" matplotlib-base = ">=3.9" -#jupyterlab = ">=4.2" -#jupyterlab-myst = ">=2.4" +jupyterlab = ">=4.2" +jupyterlab-myst = ">=2.4" pytest = ">=8.3.5,<9" -#nbval = ">=0.11.0,<0.12" -#jupytext = ">=1.17.1,<2" - -[pypi-dependencies] -#sphinx = ">=8.0.2" -#myst-nb = ">=1.1" -#jupytext = ">=1.16" -#sphinx-book-theme = ">=1.1" -#sphinx-copybutton = ">=0.5" -#sphinx-design = "*" -#pytest-custom_exit_code = "*" +nbval = ">=0.11.0,<0.12" +jupytext = ">=1.17.1,<2" +ipympl = "*" + +[feature.base.pypi-dependencies] +sphinx = ">=8.0.2" +myst-nb = ">=1.1" +jupytext = ">=1.16" +sphinx-book-theme = ">=1.1" +sphinx-copybutton = ">=0.5" +sphinx-design = "*" +pytest-custom_exit_code = "*" [feature.py312] platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"] @@ -97,7 +101,8 @@ cmd = "python -m http.server 8000 -d _build/html/jupyterlite/" depends-on = ["build_wasm"] [environments] -py312 = ["py312"] -py313 = ["py313"] +default = ["base"] +py312 = ["base", "py312"] +py313 = ["base", "py313"] jupyterlite-runtime = ["jupyterlite-runtime"] jupyterlite-host = ["jupyterlite-host"] From 89559da2d55f3c4ff851b1fd8ee023f2b6309898 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 14 May 2025 18:17:46 -0500 Subject: [PATCH 10/18] Indirection for activation script since extension is important --- activate.sh | 1 + pixi.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 activate.sh diff --git a/activate.sh b/activate.sh new file mode 100644 index 0000000..4c54c9c --- /dev/null +++ b/activate.sh @@ -0,0 +1 @@ +source $(dirname $0)/.binder/postBuild diff --git a/pixi.toml b/pixi.toml index 09115a1..ec374b7 100644 --- a/pixi.toml +++ b/pixi.toml @@ -32,7 +32,7 @@ test = "bash ./test.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 {$PIXI_PROJECT_ROOT}/.binder/postBuild"] +scripts = ["activate.sh"] [feature.base.dependencies] python = ">=3.11" From ec9f315699b7131f9d8b5c14c53ee74ee87a0590 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 14 May 2025 18:33:03 -0500 Subject: [PATCH 11/18] Fix activation script --- activate.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/activate.sh b/activate.sh index 4c54c9c..eb3c39a 100644 --- a/activate.sh +++ b/activate.sh @@ -1 +1,6 @@ -source $(dirname $0)/.binder/postBuild +#!/usr/bin/env bash + +set -eux + +mkdir -p ${CONDA_PREFIX}/share/jupyter/lab/settings +cp ${PIXI_PROJECT_ROOT}/.binder/overrides.json ${CONDA_PREFIX}/share/jupyter/lab/settings/overrides.json From d64e68b90c15bdb574b6a1789b7c37124607fe67 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 14 May 2025 19:10:18 -0500 Subject: [PATCH 12/18] Add script to convert md files into ipynb for jupyterlite --- convert_all_jupyterlite.sh | 30 ++++++++++++++++++++++++++++++ pixi.toml | 5 +++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100755 convert_all_jupyterlite.sh diff --git a/convert_all_jupyterlite.sh b/convert_all_jupyterlite.sh new file mode 100755 index 0000000..c89117d --- /dev/null +++ b/convert_all_jupyterlite.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Find Markdown files convert. +all_markdown_files=$(find tutorials -type f) +if [ $# -gt 0 ]; then + files_to_process="$@" +else + files_to_process=$all_markdown_files +fi + +OUTDIR="_build/ipynbs" + +# Identify Markdown files that are Jupytext and convert them all. +for file in ${files_to_process}; do + echo "Making directory: $OUTDIR/$(dirname $file)" + mkdir -p $OUTDIR/$(dirname $file) + + echo loop in $file + # Extract the kernel information from the Jupytext Markdown file. + kernel_info=$(grep -A 10 '^---$' "$file" | grep -E 'kernelspec') + # Skip if no kernel information was found. + if [ -z "$kernel_info" ]; then + cp $file $OUTDIR/$file + continue + fi + # Convert to ipynb format, to be consumed by pytest nbval plugin. + notebook_file="${file%.md}.ipynb" + jupytext --to ipynb "$file" --output $OUTDIR/${notebook_file} + # Stash file in array to be cleaned up at the end. +done diff --git a/pixi.toml b/pixi.toml index ec374b7..47ad6ee 100644 --- a/pixi.toml +++ b/pixi.toml @@ -89,10 +89,11 @@ jupyterlab-myst = ">=2.4" [feature.jupyterlite-host.tasks] setup_wasm = {cmd = "pixi install -e jupyterlite-runtime", inputs = ["pixi.lock"]} +convert_ipynbs = {cmd = "bash convert_all_jupyterlite.sh", inputs = ["tutorials/"], outputs = ["_build/ipynbs"]} [feature.jupyterlite-host.tasks.build_wasm] -cmd = "jupyter lite build --XeusAddon.prefix=.pixi/envs/jupyterlite-runtime --contents tutorials --output-dir _build/html/jupyterlite --settings-overrides=.binder/overrides.json --log-level DEBUG" -depends-on = ["setup_wasm"] +cmd = "jupyter lite build --XeusAddon.prefix=.pixi/envs/jupyterlite-runtime --contents _build/ipynbs/tutorials --output-dir _build/html/jupyterlite --settings-overrides=.binder/overrides.json --log-level DEBUG" +depends-on = ["setup_wasm", "convert_ipynbs"] outputs = ["_build/html/jupyterlite/"] inputs = ["pixi.lock", "tutorials/"] From 84e16c4ec7eae5ccb12e982d564a18499a9400fa Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 14 May 2025 19:18:16 -0500 Subject: [PATCH 13/18] Add some pins in pixi.toml for jupyterlite deps --- .gitignore | 6 +++--- pixi.toml | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index a452f66..c866267 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,9 @@ _build/* # No .ipynb files should be stored in this repository. *.ipynb +# Jupyterlite Database +.jupyterlite.doit.db + # We treat this repository as a library, not an application, and thus we do not # include the lockfile in source control. For a specific event, like a # workshop, we suggest committing the lockfile on a branch dedicated to the @@ -95,9 +98,6 @@ target/ # Jupyter Notebook .ipynb_checkpoints -# Jupyterlite Database -.jupyterlite.doit.db - # IPython profile_default/ ipython_config.py diff --git a/pixi.toml b/pixi.toml index 47ad6ee..ecc9360 100644 --- a/pixi.toml +++ b/pixi.toml @@ -42,7 +42,7 @@ jupyterlab-myst = ">=2.4" pytest = ">=8.3.5,<9" nbval = ">=0.11.0,<0.12" jupytext = ">=1.17.1,<2" -ipympl = "*" +ipympl = ">=0.9" [feature.base.pypi-dependencies] sphinx = ">=8.0.2" @@ -71,10 +71,10 @@ platforms = ["emscripten-wasm32"] [feature.jupyterlite-runtime.dependencies] xeus-python = "*" -python = "*" -matplotlib = "*" -ipympl = "*" -jupytext = "*" +python = ">=3.11" +matplotlib = ">=3.9" +ipympl = ">=0.9" +jupytext = ">=1.16" [feature.jupyterlite-host] channels = ["conda-forge"] From c1b8e959f647e913f55c0a2f0a47fee052648cb9 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 14 May 2025 19:25:11 -0500 Subject: [PATCH 14/18] Fix merge conflict --- index.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/index.md b/index.md index 84a53a4..cd34eab 100644 --- a/index.md +++ b/index.md @@ -25,13 +25,8 @@ launch JupyterLab. git clone https://github.com/scientific-python/executable-tutorials cd executable-tutorials -<<<<<<< HEAD python -m venv .venv source .venv/bin/activate -======= -python -m venv venv -source venv/bin/activate ->>>>>>> d8cca2b (Explain how to launch executable tutorials.) pip install -r requirements.txt jupyter lab From 9aa694c3f58b0381314e82ea5ce21eb7c717b246 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 14 May 2025 19:25:32 -0500 Subject: [PATCH 15/18] Better comment conversion script --- convert_all_jupyterlite.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/convert_all_jupyterlite.sh b/convert_all_jupyterlite.sh index c89117d..12e8ff2 100755 --- a/convert_all_jupyterlite.sh +++ b/convert_all_jupyterlite.sh @@ -1,24 +1,29 @@ #!/bin/bash +# This is a script which copies the contents of the tutorials +# directory into a build directory (_build/ipynbs). +# The notebook markdown files are converted to ipynbs with other +# files (non-executable md files, static images, etc) are copied +# directly. +# This is intended for jupyterlite to build pointing to the build +# directory since the markdown files do not currently work in +# jupyterlite. + # Find Markdown files convert. -all_markdown_files=$(find tutorials -type f) -if [ $# -gt 0 ]; then - files_to_process="$@" -else - files_to_process=$all_markdown_files -fi +files_to_process=$(find tutorials -type f) OUTDIR="_build/ipynbs" # Identify Markdown files that are Jupytext and convert them all. for file in ${files_to_process}; do + # Ensure result directory exists echo "Making directory: $OUTDIR/$(dirname $file)" mkdir -p $OUTDIR/$(dirname $file) echo loop in $file # Extract the kernel information from the Jupytext Markdown file. kernel_info=$(grep -A 10 '^---$' "$file" | grep -E 'kernelspec') - # Skip if no kernel information was found. + # Copy directly if not a notebook file if [ -z "$kernel_info" ]; then cp $file $OUTDIR/$file continue @@ -26,5 +31,4 @@ for file in ${files_to_process}; do # Convert to ipynb format, to be consumed by pytest nbval plugin. notebook_file="${file%.md}.ipynb" jupytext --to ipynb "$file" --output $OUTDIR/${notebook_file} - # Stash file in array to be cleaned up at the end. done From 18654820751aa2bda823902086cd2b4aa5ac97a0 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 14 May 2025 19:39:36 -0500 Subject: [PATCH 16/18] Add jupytext to jupyterlite-host for conversion --- pixi.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pixi.toml b/pixi.toml index ecc9360..d8eec2a 100644 --- a/pixi.toml +++ b/pixi.toml @@ -86,6 +86,7 @@ jupyterlite-core = "==0.4.0" jupyterlite-xeus = "*" notebook = "~=7.2.1" jupyterlab-myst = ">=2.4" +jupytext = ">=1.16" [feature.jupyterlite-host.tasks] setup_wasm = {cmd = "pixi install -e jupyterlite-runtime", inputs = ["pixi.lock"]} From 98b65bfb4c8153e86fef51551764e540fd87596e Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 14 May 2025 19:44:51 -0500 Subject: [PATCH 17/18] Add ipympl to jupyterlite-host env --- pixi.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pixi.toml b/pixi.toml index d8eec2a..c7afd6d 100644 --- a/pixi.toml +++ b/pixi.toml @@ -87,6 +87,7 @@ jupyterlite-xeus = "*" notebook = "~=7.2.1" jupyterlab-myst = ">=2.4" jupytext = ">=1.16" +ipympl = ">=0.9" [feature.jupyterlite-host.tasks] setup_wasm = {cmd = "pixi install -e jupyterlite-runtime", inputs = ["pixi.lock"]} From e7d2c81de5a612d1bba44ab707cceb7501bc159f Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 14 May 2025 19:53:09 -0500 Subject: [PATCH 18/18] Add jupyterlite build_wasm to ci/cd workflows --- .github/workflows/cd.yml | 5 ++++- .github/workflows/ci.yml | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 6d0fdef..c74882a 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -29,9 +29,12 @@ jobs: - name: Setup pixi uses: prefix-dev/setup-pixi@19eac09b398e3d0c747adc7921926a6d802df4da # v0.8.8 - - name: Build executed notebooks and HTML + - name: Build HTML run: pixi run build + - name: Build jupyterlite + run: pixi run build_wasm + - name: Upload executed notebooks as GitHub artifact (for debugging) uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8587102..edf8496 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,3 +100,15 @@ jobs: - name: Build static site run: pixi run build + + pixi_build_wasm: + name: Build jupyterlite site with pixi + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup pixi + uses: prefix-dev/setup-pixi@v0.8.1 + + - name: Build jupyterlite site + run: pixi run build_wasm