Skip to content

Commit c2c09af

Browse files
mmckyclaude
andcommitted
Merge branch 'main' into jb2
Resolves the two ci.yml conflicts, both from main evolving steps that jb2 rewrote for the mystmd toolchain: - Install JAX: took main's side — the jax 0.11.0 pin rationale comment (jax 0.11.1 hangs fori_loop on CPU paths) and the numpyro install apply to the executed lectures regardless of build toolchain. - The old jupyter-book steps (texlive, build-cache download, the jb clean prune from #616, sphinx-tojupyter): kept jb2's side — these steps do not exist in the myst pipeline, which builds cold with no restored sphinx cache, so the staleness problem the prune step addresses cannot occur here. The execution-cache key hashes ci.yml, so this merge forces a cold build — the pin, numpyro, and the v2.3.0 theme bump are all validated by real execution rather than replayed outputs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2 parents 43f2200 + c2589a2 commit c2c09af

17 files changed

Lines changed: 181 additions & 90 deletions

.github/workflows/cache.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ jobs:
2121
- name: Install JAX and Numpyro
2222
shell: bash -l {0}
2323
run: |
24-
pip install -U "jax[cuda13]"
24+
# Pinned: jax 0.11.1 (2026-08-17) hangs numpy_vs_numba_vs_jax's
25+
# lax.fori_loop cells -- they jit with device=cpu, so the CPU-path
26+
# regression bites even on these GPU runners. Context is recorded in
27+
# QuantEcon/workspace-lectures#49. With jax already present, the
28+
# lecture's unpinned `!pip install quantecon jax` cell is satisfied
29+
# and does not upgrade.
30+
pip install "jax[cuda13]==0.11.0"
2531
pip install numpyro
2632
python scripts/test-jax-install.py
2733
- name: Check nvidia drivers

.github/workflows/ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ on: [pull_request]
33
jobs:
44
preview:
55
runs-on: "runs-on=${{ github.run_id }}/family=g4dn.2xlarge/image=quantecon_ubuntu2404/volume=80gb/spot=false"
6+
permissions:
7+
contents: read
8+
actions: read # dawidd6/action-download-artifact reads the cache.yml build artifact
9+
pull-requests: write
610
steps:
711
- uses: actions/checkout@v7
812

@@ -49,7 +53,14 @@ jobs:
4953
- name: Install JAX
5054
if: steps.cache-execution.outputs.cache-hit != 'true'
5155
run: |
56+
# Pinned: jax 0.11.1 (2026-08-17) hangs numpy_vs_numba_vs_jax's
57+
# lax.fori_loop cells -- they jit with device=cpu, so the CPU-path
58+
# regression bites even on these GPU runners. Context is recorded in
59+
# QuantEcon/workspace-lectures#49. With jax already present, the
60+
# lecture's unpinned `!pip install quantecon jax` cell is satisfied
61+
# and does not upgrade.
5262
pip install "jax[cuda13]==0.11.0"
63+
pip install numpyro
5364
python scripts/test-jax-install.py
5465
5566
# Pinned to the exact SHA of the fork's main (unmoved since 2026-06-12,

.github/workflows/execution-linux.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
schedule:
44
# UTC 15:00 is early morning in Australia
55
- cron: '0 15 * * *'
6+
workflow_dispatch:
67
jobs:
78
execution-tests-linux:
89
name: Execution Tests (${{ matrix.python-version }}, ${{ matrix.os }})
@@ -23,11 +24,22 @@ jobs:
2324
shell: bash -l {0}
2425
run: |
2526
conda install anaconda
26-
pip install jupyter-book sphinx-multitoc-numbering quantecon-book-theme sphinxext-rediraffe sphinx-tojupyter sphinx-exercise sphinx-togglebutton
27+
# jupyter-book pinned <2: the 2.x line drops the jb CLI (see #569);
28+
# this repo stays on jupyter-book 1.x until a JB2-compatible theme
29+
# exists (mirrors the <2.0 pin in environment.yml)
30+
pip install "jupyter-book<2" sphinx-multitoc-numbering quantecon-book-theme sphinxext-rediraffe sphinx-tojupyter sphinx-exercise sphinx-togglebutton
2731
- name: Install Jax [CPU]
2832
shell: bash -l {0}
2933
run: |
30-
pip install "jax[CPU]"
34+
# Pinned: jax 0.11.1 (2026-08-17) regresses XLA:CPU execution --
35+
# numpy_vs_numba_vs_jax's lax.fori_loop and lax.scan cells go
36+
# quadratic in n, so this -W build dies on CellTimeoutError. Matches
37+
# the pin already in cache/ci/publish.yml; evidence and the exposure
38+
# map are recorded in QuantEcon/workspace-lectures#49. With jax
39+
# already present, the lecture's unpinned
40+
# `!pip install quantecon jax` cell is satisfied and does not
41+
# upgrade.
42+
pip install "jax[CPU]==0.11.0"
3143
- name: Build Lectures (+ Execution Checks)
3244
shell: bash -l {0}
3345
run: jb build lectures --path-output=./ -W --keep-going

.github/workflows/execution-osx.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
schedule:
44
# UTC 16:00 is early morning in Australia
55
- cron: '0 15 * * 1'
6+
workflow_dispatch:
67
jobs:
78
execution-tests-osx:
89
name: Execution Tests (${{ matrix.python-version }}, ${{ matrix.os }})
@@ -23,11 +24,22 @@ jobs:
2324
shell: bash -l {0}
2425
run: |
2526
conda install anaconda
26-
pip install jupyter-book sphinx-multitoc-numbering quantecon-book-theme sphinxext-rediraffe sphinx-tojupyter sphinx-exercise sphinx-togglebutton
27+
# jupyter-book pinned <2: the 2.x line drops the jb CLI (see #569);
28+
# this repo stays on jupyter-book 1.x until a JB2-compatible theme
29+
# exists (mirrors the <2.0 pin in environment.yml)
30+
pip install "jupyter-book<2" sphinx-multitoc-numbering quantecon-book-theme sphinxext-rediraffe sphinx-tojupyter sphinx-exercise sphinx-togglebutton
2731
- name: Install Jax [CPU]
2832
shell: bash -l {0}
2933
run: |
30-
pip install "jax[CPU]"
34+
# Pinned: jax 0.11.1 (2026-08-17) regresses XLA:CPU execution --
35+
# numpy_vs_numba_vs_jax's lax.fori_loop and lax.scan cells go
36+
# quadratic in n, so this -W build dies on CellTimeoutError. Matches
37+
# the pin already in cache/ci/publish.yml; evidence and the exposure
38+
# map are recorded in QuantEcon/workspace-lectures#49. With jax
39+
# already present, the lecture's unpinned
40+
# `!pip install quantecon jax` cell is satisfied and does not
41+
# upgrade.
42+
pip install "jax[CPU]==0.11.0"
3143
- name: Build Lectures (+ Execution Checks)
3244
shell: bash -l {0}
3345
run: jb build lectures --path-output=./ -W --keep-going

.github/workflows/execution-win.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
schedule:
44
# UTC 17:00 is early morning in Australia
55
- cron: '0 15 * * 4'
6+
workflow_dispatch:
67
jobs:
78
execution-tests-win:
89
name: Execution Tests (${{ matrix.python-version }}, ${{ matrix.os }})
@@ -27,12 +28,22 @@ jobs:
2728
conda install anaconda
2829
conda install -c numba numba
2930
conda install -c numba llvmlite
30-
pip install jupyter-book
31-
pip install jupyter-book sphinx-multitoc-numbering quantecon-book-theme sphinxext-rediraffe sphinx-tojupyter sphinx-exercise sphinx-togglebutton
31+
# jupyter-book pinned <2: the 2.x line drops the jb CLI (see #569);
32+
# this repo stays on jupyter-book 1.x until a JB2-compatible theme
33+
# exists (mirrors the <2.0 pin in environment.yml)
34+
pip install "jupyter-book<2" sphinx-multitoc-numbering quantecon-book-theme sphinxext-rediraffe sphinx-tojupyter sphinx-exercise sphinx-togglebutton
3235
- name: Install Jax [CPU]
3336
shell: bash -l {0}
3437
run: |
35-
pip install "jax[CPU]"
38+
# Pinned: jax 0.11.1 (2026-08-17) regresses XLA:CPU execution --
39+
# numpy_vs_numba_vs_jax's lax.fori_loop and lax.scan cells go
40+
# quadratic in n, so this -W build dies on CellTimeoutError. Matches
41+
# the pin already in cache/ci/publish.yml; evidence and the exposure
42+
# map are recorded in QuantEcon/workspace-lectures#49. With jax
43+
# already present, the lecture's unpinned
44+
# `!pip install quantecon jax` cell is satisfied and does not
45+
# upgrade.
46+
pip install "jax[CPU]==0.11.0"
3647
- name: Build Lectures (+ Execution Checks)
3748
shell: powershell
3849
run: jb build lectures --path-output=./ -W --keep-going

.github/workflows/publish.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ concurrency:
1717
jobs:
1818
publish:
1919
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
20-
runs-on: "runs-on=${{ github.run_id }}/family=g4dn.2xlarge/image=quantecon_ubuntu2404/volume=80gb"
20+
runs-on: "runs-on=${{ github.run_id }}/family=g4dn.2xlarge/image=quantecon_ubuntu2404/volume=80gb/spot=false"
2121
environment:
2222
name: github-pages
2323
url: ${{ steps.deployment.outputs['page-url'] }}
@@ -38,7 +38,13 @@ jobs:
3838
- name: Install JAX and Numpyro
3939
shell: bash -l {0}
4040
run: |
41-
pip install -U "jax[cuda13]"
41+
# Pinned: jax 0.11.1 (2026-08-17) hangs numpy_vs_numba_vs_jax's
42+
# lax.fori_loop cells -- they jit with device=cpu, so the CPU-path
43+
# regression bites even on these GPU runners. Context is recorded in
44+
# QuantEcon/workspace-lectures#49. With jax already present, the
45+
# lecture's unpinned `!pip install quantecon jax` cell is satisfied
46+
# and does not upgrade.
47+
pip install "jax[cuda13]==0.11.0"
4248
pip install numpyro
4349
python scripts/test-jax-install.py
4450
- name: Check nvidia drivers
@@ -72,6 +78,15 @@ jobs:
7278
branch: main
7379
name: build-cache
7480
path: _build
81+
# Prune the restored _build/html so files deleted from source stop being
82+
# published: sphinx copies html_static_path in but never removes stale
83+
# assets. `jb clean . --html` removes exactly _build/html, leaving
84+
# .jupyter_cache (the expensive execution cache), _build/latex and
85+
# _build/jupyter untouched. Must run BEFORE the PDF/notebook steps below,
86+
# which stage output INTO _build/html.
87+
- name: Prune restored HTML (drop stale assets deleted from source)
88+
shell: bash -l {0}
89+
run: jb clean . --html
7590
# Build Assets (Download Notebooks, PDF via LaTeX)
7691
- name: Build PDF from LaTeX
7792
shell: bash -l {0}
@@ -104,7 +119,7 @@ jobs:
104119
# Deploy to GitHub Pages + publish release assets (html archive, checksum, manifest)
105120
- name: Deploy to GitHub Pages
106121
id: deployment
107-
uses: quantecon/actions/publish-gh-pages@v0.9.0
122+
uses: quantecon/actions/publish-gh-pages@v0.11.1
108123
with:
109124
build-dir: _build/html
110125
cname: python-programming.quantecon.org

lectures/_static/lecture_specific/pandas/data/test_pwt.csv

Lines changed: 0 additions & 9 deletions
This file was deleted.

lectures/about_py.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ popularity of a single Python deep learning library
137137

138138
```{figure} /_static/lecture_specific/about_py/pytorch_vs_matlab.png
139139
```
140-
Pytorch is just one of several Python libraries for deep learning and AI.
140+
PyTorch is just one of several Python libraries for deep learning and AI.
141141

142142

143143

@@ -340,7 +340,7 @@ We will discuss the details later in the lecture series, where we cover NumPy in
340340
While NumPy is still the king of array processing in Python, there are now
341341
important competitors.
342342

343-
Libraries such as [JAX](https://github.com/jax-ml/jax), [Pytorch](https://pytorch.org/), and [CuPy](https://cupy.dev/) also have
343+
Libraries such as [JAX](https://github.com/jax-ml/jax), [PyTorch](https://pytorch.org/), and [CuPy](https://cupy.dev/) also have
344344
built in array types and array operations that can be very fast and efficient.
345345

346346
In fact these libraries are better at exploiting parallelization and fast hardware, as

lectures/autodiff.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,11 @@ Let's generate some simulated data:
350350
```{code-cell} ipython3
351351
n = 100
352352
key = jax.random.key(1234)
353-
x = jax.random.uniform(key, (n,))
353+
key, x_key, ϵ_key = jax.random.split(key, 3)
354+
x = jax.random.uniform(x_key, (n,))
354355
355356
α, β, σ = 0.5, 1.0, 0.1 # Set the true intercept and slope.
356-
key, subkey = jax.random.split(key)
357-
ϵ = jax.random.normal(subkey, (n,))
357+
ϵ = jax.random.normal(ϵ_key, (n,))
358358
359359
y = α * x + β + σ * ϵ
360360
```

lectures/functions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,11 +435,11 @@ def x(t):
435435
return 2 * x(t-1)
436436
```
437437

438-
What happens here is that each successive call uses it's own *frame* in the *stack*
438+
What happens here is that each successive call uses its own *frame* in the *stack*
439439

440440
* a frame is where the local variables of a given function call are held
441441
* stack is memory used to process function calls
442-
* a First In Last Out (FILO) queue
442+
* a last-in, first-out (LIFO) data structure
443443

444444
This example is somewhat contrived, since the first (iterative) solution would usually be preferred to the recursive solution.
445445

0 commit comments

Comments
 (0)