Skip to content

site-build: build the notebooks of a site that publishes them, and serve them at _notebooks/ - #104

Merged
mmcky merged 1 commit into
mainfrom
site-build/notebooks
Nov 26, 2026
Merged

mmcky merged 1 commit into
mainfrom
site-build/notebooks

Conversation

@mmcky

@mmcky mmcky commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

For QuantEcon/project-monorepo#77 ("with HTML, PDF and notebooks"): the notebooks. A site whose site.yml publishes notebooks now gets them, as its series' own publish does: the jupyter builder, strict, with the notebooks served at _build/html/_notebooks/, where quantecon-book-theme links each page's "Download Notebook" button. All four sites built today publish notebooks: dp since QuantEcon/lecture-dp#87, and intro, advanced and programming throughout. A release from the pool (#103) needs them, as does dp's shadow comparison.

The order, and why it differs from the series'

The series build the notebooks first, then the HTML with html-copy-notebooks. Here that order would break the cache. On a cold build the notebook build would execute every page, the HTML build would then take every page from the cache, and the execution report, which reads the HTML build, would count 0 executed, so main would never save its cache.

The theme shows the button when _build/html/_notebooks/ is a folder as it renders a page (os.path.isdir(app.outdir / "_notebooks"), quantecon-book-theme 0.22.2). So:

  1. make that folder;
  2. build the HTML, as now: it executes the pages, and the report counts them;
  3. write the execution report;
  4. build the notebooks, strict, from the cache the HTML build filled (after the report, because this build rewrites the environment the report reads);
  5. copy each notebook under _build/jupyter into _build/html/_notebooks/ at the same path, as build-lectures' html-copy-notebooks does.

The site gets the same files and the same buttons as the series' order would give it.

Each new step runs only for a site that publishes notebooks. The notebook build has its own failure artefact, execution-reports-<key>-notebooks.

What to expect from this pull request's builds

The keys don't change, so every site restores its cache, and the notebook build takes every page from it. Each site's HTML gains the button and _notebooks/. I'll compare the result with the series' own sites (dp's 52 notebooks, as in QuantEcon/lecture-dp#87's comparison) and post it here.

actionlint is clean. Copilot: not requested (Matt, 2026-11-22).

🤖 Generated with Claude Code

https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG

…rve them at _notebooks/

A site whose site.yml publishes notebooks now gets them, as its series'
own publish does: the jupyter builder, strict, and the notebooks under
_build/html/_notebooks/, where quantecon-book-theme links each page's
"Download Notebook" button. dp's live site has done so since
QuantEcon/lecture-dp#87, and the notebooks belong in a release from
the pool (QuantEcon/project-monorepo#78).

The order differs from the series': the theme shows the button when
_build/html/_notebooks/ is a folder as it renders a page, so the folder
is made before the HTML build, and the notebooks are built after it
and copied in. The HTML build stays the one that executes the pages,
which the execution report counts and the cache save depends on; the
notebook build runs after the report (it rewrites the environment the
report reads), from the cache the HTML build filled.

- site-build.yml: the folder, the jupyter build (its own failure
  artefact, execution-reports-<key>-notebooks) and the copy, each only
  for a site that publishes notebooks; the leg's steps in the header.
- sites/README.md: what `publishes` now does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
@mmcky

mmcky commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

The builds

Site-build 45813283589 at b0e540b is green on all four sites. Each restored main's cache under its unchanged key, so the HTML build and the notebook build both took every page from the cache.

Site Notebooks copied Pages Pages with the "Download Notebook" link
dp 53 58 56
intro 57 66 60
advanced 80 85 83
programming 27 31 29

The pages without the link are each site's index and index_toc, and on intro its four redirect pages (ak2, lake_model, lln_clt, mle), the one-line pages its renames left. The theme gives every other page one, including genindex, search and prf-prf, which have no notebook; intermediate's live site does the same (QuantEcon/lecture-dp#87's comparison).

dp's links go to https://quantecon.github.io/lecture-dp/_notebooks/<page>.ipynb, from the site's download_nb_path, as on dp's live site.

dp's notebooks against lecture-dp#87's own build (QuantEcon/lecture-dp 45712899886, also 53): the same names but two.

  • mccall_risk.ipynb is here only: it's the lecture dp's site adds from intermediate (a # site addition in sites/dp/_toc.yml).
  • _static/lecture_specific/short_path/Graph-networkx2.ipynb is there only: a file in dp's own _static/ that no lecture references. The pool promotes only the assets a lecture uses, so it never had it. dp's live site publishes it under _notebooks/ only because the series' copy step takes every .ipynb under _build/jupyter.

The execution report ran before the notebook build, as intended. On a cold build, it counts the pages the HTML build executed, and main saves its cache as before.

@mmcky
mmcky merged commit 78f1eda into main Nov 26, 2026
7 checks passed
@mmcky
mmcky deleted the site-build/notebooks branch November 26, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant