From 0a4e84687376e9181ee59465d8c54593f7b7d80f Mon Sep 17 00:00:00 2001 From: kp992 Date: Tue, 29 Sep 2026 18:04:17 -0700 Subject: [PATCH 1/2] feat: per-page WASM opt-in on functions and matplotlib lectures - project.jupyter.lite: true enables Thebe infrastructure - default_thebe: false (site.options) keeps Power toggle hidden by default - functions.md and matplotlib.md opt in via site: enable_thebe: true - ci.yml builds theme from per-page-thebe branch (temporary until release) --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ lectures/functions.md | 2 ++ lectures/matplotlib.md | 2 ++ lectures/myst.yml | 5 +++++ 4 files changed, 30 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21e7ca2f..03e7e837 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,6 +114,27 @@ jobs: # silently ignored the fork we install above and built with upstream # mystmd (visible as 23 `unknown export output extension: *.ipynb` # errors, since ipynb export is a fork-only capability). + # Build the theme from per-page-thebe (adds enable_thebe/disable_thebe/ + # default_thebe support). Remove this step once the feature ships in a + # tagged release and the template URL below is bumped to that release. + - name: Build theme (per-page-thebe) + run: | + git clone --depth 1 --branch per-page-thebe \ + https://github.com/QuantEcon/quantecon-theme.mystmd.git /tmp/qe-theme + cd /tmp/qe-theme && npm ci && make build-theme + # Patch myst.yml to use the local build instead of the release zip. + python -c " + import re + path = 'lectures/myst.yml' + txt = open(path).read() + txt = re.sub( + r'template: https://github\.com/QuantEcon/quantecon-theme\.mystmd/releases/download/[^\n]+', + 'template: /tmp/qe-theme/.deploy/quantecon-theme', + txt + ) + open(path, 'w').write(txt) + " + - name: Build HTML working-directory: ./lectures env: diff --git a/lectures/functions.md b/lectures/functions.md index db4f7ab4..c6249c62 100644 --- a/lectures/functions.md +++ b/lectures/functions.md @@ -17,6 +17,8 @@ downloads: title: Markdown (md) - file: exports/functions.ipynb title: IPython (.ipynb) +site: + enable_thebe: true --- # Functions diff --git a/lectures/matplotlib.md b/lectures/matplotlib.md index b39e45a1..bd1042a7 100644 --- a/lectures/matplotlib.md +++ b/lectures/matplotlib.md @@ -17,6 +17,8 @@ downloads: title: Markdown (md) - file: exports/matplotlib.ipynb title: IPython (.ipynb) +site: + enable_thebe: true --- # Matplotlib diff --git a/lectures/myst.yml b/lectures/myst.yml index 6884fd7d..aaaba069 100644 --- a/lectures/myst.yml +++ b/lectures/myst.yml @@ -80,6 +80,8 @@ project: error_rules: - rule: reference-syntax-valid severity: ignore + jupyter: + lite: true # exports: # - id: book-pdf # format: typst @@ -109,3 +111,6 @@ site: launch_notebook_repo: QuantEcon/lecture-python-programming.notebooks launch_notebook_source_dir: lectures launch_colab: true + # Opt-in mode: Power toggle is hidden site-wide; only pages that set + # `site: enable_thebe: true` in their frontmatter show it. + default_thebe: false From 811dc0e52350785752eee4402f2cf350c4d656b1 Mon Sep 17 00:00:00 2001 From: kp992 Date: Tue, 29 Sep 2026 18:15:34 -0700 Subject: [PATCH 2/2] fix: use GITHUB_WORKSPACE in theme-patch path --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03e7e837..659c941a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -124,8 +124,8 @@ jobs: cd /tmp/qe-theme && npm ci && make build-theme # Patch myst.yml to use the local build instead of the release zip. python -c " - import re - path = 'lectures/myst.yml' + import re, os + path = os.path.join(os.environ['GITHUB_WORKSPACE'], 'lectures/myst.yml') txt = open(path).read() txt = re.sub( r'template: https://github\.com/QuantEcon/quantecon-theme\.mystmd/releases/download/[^\n]+',