You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
build-lectures: html-copy-notebooks flattens the notebooks, so a nested page's download link leads nowhere #217
Found while fact-checking the build-lectures chapter of the user manual (#190, #213).
What happens
With html-copy-notebooks: 'true', build-lectures copies every notebook from _build/jupyter into _build/html/_notebooks/, flat (build-lectures/action.yml, "Stage notebooks for HTML build"):
The jupyter build keeps the book's directories, and quantecon-book-theme links each page to its notebook with the page's directory in the path. In 0.22.0, the version the images pin (quantecon_book_theme/__init__.py:596-605):
A page in a subdirectory gets a link to /_notebooks/<dir>/<page>.ipynb, but its notebook was copied to /_notebooks/<page>.ipynb. The download link leads nowhere.
Two notebooks with the same name in different directories overwrite each other, silently.
A book whose lectures are all at the top of source-dir, as most QuantEcon lecture repositories are, is not affected.
The PDF copy can stay flat: the theme links one book PDF, /_pdf/<LaTeX document name>.pdf.
A harness test would need a nested page in the fixture's jupyter and html builds, with an assertion that _build/html/_notebooks/<dir>/<page>.ipynb exists.
Related, not in this repository
Both of the theme's download links start at the site's root, /_notebooks/… and /_pdf/…. So they lead nowhere on a site served under a path, such as a GitHub Pages project site with no custom domain. The theme's download_nb_path option sets a prefix for the notebook links; the PDF link has none. That belongs to QuantEcon/quantecon-book-theme.
The manual's build-lectures chapter (#213) states both limits and links here.
Checked against main at 9644f17 (2026-11-06): the bug stands, but the fix needs two revisions. The copy is still flat (build-lectures/action.yml:181). sphinx-tojupyter 0.6.0 still writes _build/jupyter/<dir>/<page>.ipynb. quantecon-book-theme's link code is the same in 0.22.1, which the full image pins, and in 0.22.2, which the lean image now has (src/quantecon_book_theme/__init__.py:596-605). No caller is affected today: the only callers that set html-copy-notebooks are the canary and QuantEcon/test-lecture-theme-sphinx, and the canary's lectures are all at the top level.
First, the proposed command stages nothing as written. NB_DEST is relative to the workspace (./_build/html/_notebooks by default), so after the cd into _build/jupyter it points at a directory that does not exist. Every cp then fails, and a failed -exec … \; does not fail find, so the step passes having copied nothing. cp --parents is also GNU-only. The revision copies each notebook to the same relative path under _notebooks/ without a cd, with a find -print0 loop that runs mkdir -p and cp for each notebook, so a failed copy now fails the step. The PDF copy stays flat. It has the same -exec cp … \; (build-lectures/action.yml:158), so it gets -exec sh -c 'cp "$@" "$0"' "$PDF_DEST/" {} +, which makes find exit non-zero when cp fails. The shorter -exec cp {} "$PDF_DEST/" + is refused by find, which needs {} just before the +.
Second, the test is now small. #265 added the build-html-copy harness job, which puts stand-in files in _build/jupyter and checks the copies. A stand-in sub/lecture1.ipynb beside the top-level lecture1.ipynb checks both halves of this bug, the nested path and the name collision, and it fails against main today. The fixture needs no nested page.
The fix also updates the html-copy-notebooks description and the chapter's two caveats (docs/user/actions/build-lectures.md:127, :152). It is not breaking: top-level notebooks land where they did. The theme's root-relative links stay with QuantEcon/quantecon-book-theme.
Activity
docs(manual): correct the build chapters against the code; CHANGELOG
docs(manual): chapters for the other seven actions, and delete QUICK-…
mmcky commentedon Nov 6, 2026
Checked against
mainat9644f17(2026-11-06): the bug stands, but the fix needs two revisions. The copy is still flat (build-lectures/action.yml:181). sphinx-tojupyter 0.6.0 still writes_build/jupyter/<dir>/<page>.ipynb. quantecon-book-theme's link code is the same in 0.22.1, which the full image pins, and in 0.22.2, which the lean image now has (src/quantecon_book_theme/__init__.py:596-605). No caller is affected today: the only callers that sethtml-copy-notebooksare the canary andQuantEcon/test-lecture-theme-sphinx, and the canary's lectures are all at the top level.First, the proposed command stages nothing as written.
NB_DESTis relative to the workspace (./_build/html/_notebooksby default), so after thecdinto_build/jupyterit points at a directory that does not exist. Everycpthen fails, and a failed-exec … \;does not failfind, so the step passes having copied nothing.cp --parentsis also GNU-only. The revision copies each notebook to the same relative path under_notebooks/without acd, with afind -print0loop that runsmkdir -pandcpfor each notebook, so a failed copy now fails the step. The PDF copy stays flat. It has the same-exec cp … \;(build-lectures/action.yml:158), so it gets-exec sh -c 'cp "$@" "$0"' "$PDF_DEST/" {} +, which makesfindexit non-zero whencpfails. The shorter-exec cp {} "$PDF_DEST/" +is refused byfind, which needs{}just before the+.Second, the test is now small. #265 added the
build-html-copyharness job, which puts stand-in files in_build/jupyterand checks the copies. A stand-insub/lecture1.ipynbbeside the top-levellecture1.ipynbchecks both halves of this bug, the nested path and the name collision, and it fails againstmaintoday. The fixture needs no nested page.The fix also updates the
html-copy-notebooksdescription and the chapter's two caveats (docs/user/actions/build-lectures.md:127,:152). It is not breaking: top-level notebooks land where they did. The theme's root-relative links stay with QuantEcon/quantecon-book-theme.Claude Code (on behalf of mmcky)
fix(build-lectures): keep each notebook's path in html-copy-notebooks…
Merge main into fix/229-bjc-alert
Merge main into fix/177-remove-require-access
docs(getting-started): drop the broken-link note for nested notebooks (…
docs(getting-started): drop the broken-link note for nested notebooks (…
fix(restore-jupyter-cache): remove the restored html after a build-ca…
release: v0.16.0 (#278)