Skip to content

Build, preview and publish the edition as lectures land #1

Description

@mmcky

This edition grows one lecture at a time. Each lecture arrives in its own pull request, where its translator reviews it; when the translator says on the PR that the review is complete, @mmcky reviews the suggestions, updates the lecture and the engine before the next lecture is drafted, and merges the PR. This issue sets up the build for that. Until all 27 pages are on main, the table of contents names lectures that do not exist yet, and cross-references dangle. So the stack copies the one the Malayalam edition uses for the same situation (QuantEcon/lecture-python-programming.ml#6). The ToC is pruned at build time, the build is not strict, every PR gets a rendered preview, and every push to main publishes. The site goes live at the default Pages URL, https://quantecon.github.io/lecture-python-programming.ja/, but no language switcher links to it until every lecture has been reviewed and the edition is announced.

The same PR carries the book's root page, intro.md, generated with the engine release that adds Japanese (QuantEcon/action-translation#340). Chihiro reviews it on that PR as a warm-up: it is two sentences and the table of contents. The PR body carries a closing line for the intro review item, #2, so merging the PR completes that item. This issue stays open after the merge and is closed by hand once the checks that can only run then have passed: the site serving the Japanese root page, and the PR's preview removed. The stack can be prepared before the release, and the PR opens for review once intro.md has been generated.

What the PR contains

File Taken from Change
.github/workflows/ci.yml ml preview URL; pinned JAX step
.github/workflows/publish.yml ml pinned JAX step
.github/workflows/reap-previews.yml ml none
scripts/prune_toc.py ml none
environment.yml ml none (channel defaults; quantecon-book-theme 0.22.0)
.github/dependabot.yml fr (identical on ml) none
lectures/_config.yml English source, via translate init repointed (below)
lectures/_toc.yml English source, via translate init six part captions in Japanese
lectures/_static/ English source, via translate init none
lectures/_admonition/gpu.md English source, copied by hand none yet (below)
lectures/intro.md and .translate/state/intro.md.yml translate init -f intro.md at the release the translator's review
REVIEWING.md already on main (committed during set-up) the house-style table filled in with the rulings recorded on QuantEcon/action-translation#337

Workflows

  • ci.yml builds each PR and deploys the result to /pr-N/ on the gh-pages branch, then comments with links to the rendered pages the PR changes, and removes the preview when the PR closes. publish.yml builds main and deploys it to the root of gh-pages on every push. reap-previews.yml runs weekly and removes previews whose PR has closed.
  • Make two changes to the ml files. Point the preview URL in ci.yml's comment step at lecture-python-programming.ja. Add fr's pinned JAX install step (pip install "jax==0.11.0") to ci.yml and publish.yml: jax 0.11.1 hangs the lax.fori_loop cells of numpy_vs_numba_vs_jax on CPU, and the programming family pins 0.11.0 (jax 0.11.1: XLA:CPU dynamic-update-slice-in-loop regression (why jax is pinned to 0.11.0) lecture-python-programming#622 records why; the English CI pin is Pin jax to 0.11.0 in CI — jax 0.11.1 hangs the fori_loop cells on CPU lecture-python-programming#617). Adding the step now means the High Performance Computing lectures build when they arrive.
  • Keep what the ml files explain in their comments: set -eo pipefail in every build step, one gh-pages concurrency group shared by all three workflows, keep_files: true on the main deploy (without it, each push wipes the open previews), and no cname input.
  • Previews deploy for branches in this repository. A PR from a fork builds but does not deploy. There is no Netlify site and no secret: everything runs on the built-in GITHUB_TOKEN.
  • The build runs jb build lectures --path-output ./ --keep-going, without -n -W, after scripts/prune_toc.py drops the ToC entries whose file is missing (keeping order and captions). Both change when the last lecture lands: the build becomes strict and the prune step goes.
  • There is no execution cache (fr has cache.yml), so every build executes every lecture present, and build time grows as lectures land.

lectures/_config.yml

translate init copies the English file. Repoint it as below. Each key was checked against the fr and ml configs on 2026-10-01.

Key Value Precedent
execute.timeout 1800, as headroom: fr raised it from 600 on 2026-08-19 (QuantEcon/lecture-python-programming.fr#36) during the jax 0.11.1 incident, whose real cause was jax itself; with jax pinned to 0.11.0, numpy_vs_numba_vs_jax executes in seconds (QuantEcon/lecture-python-programming#622) fr and fa (ml and zh-cn keep 600)
html.baseurl https://quantecon.github.io/lecture-python-programming.ja/ fr, ml
latex.latex_documents.targetname quantecon-python-programming-ja.tex fr, ml
sphinx.config.language ja: gives <html lang="ja">, Japanese interface strings and Japanese search fr, ml
html_theme_options.repository_url https://github.com/QuantEcon/lecture-python-programming.ja fr, ml
html_theme_options.nb_repository_url removed: there is no notebooks repository, and the theme skips notebook-launch links when it is unset fr, ml
languages, current_language en, fa, fr, ja, zh-cn; ja. Only this site lists ja until the edition is announced ml lists itself the same way
translators, translators_label Chihiro Watanabe and Kenko Li, each as a name (a url is optional); a Japanese label ml uses translators; both options are in quantecon-book-theme 0.22.0
tojupyter_urlpath, tojupyter_image_urlpath the .ja site URL, and the same with _static/ fr, ml
html_theme_options.analytics removed while the edition is unannounced: it is the English site's property ml (fr kept it)

No web-font stylesheet is needed (ml loads one for Malayalam). With language: ja, browsers choose Japanese system fonts.

lectures/_toc.yml

  • Translate the six part captions: Introduction to Python, Foundations of Scientific Computing, High Performance Computing, Working with Data, More Python Programming, Other. No programming edition has localised them yet.
  • @mmcky drafts them from the glossary and house style; the translators can suggest changes on this PR.
  • This is safe while source sync is off. Once sync is on, a source PR that touches _toc.yml replaces the file with the English one and the captions revert (Sync overwrites localised _toc.yml part captions with English, and nothing detects it action-translation#254), so they would need restoring by hand.

lectures/_admonition/gpu.md

This file is an {include} used by jax_intro, numpy_vs_numba_vs_jax and autodiff. It is not in the ToC, so translate init never delivers it. Copy the English file now, as ml did. Its Japanese version goes in with the first round that includes it (jax_intro, #22), where Kenko reviews it.

intro.md

Generate it with the engine's CLI built at the release tag (npm run build:cli in a checkout of the tag; shown below as translate). SOURCE is a clone of QuantEcon/lecture-python-programming at main, and TARGET is a clone of this repository. The page has no code cells, so the code-cell localisation option, --localize, does not affect it.

translate init -s SOURCE -t TARGET --target-language ja -f intro.md
  • Commit lectures/intro.md with .translate/state/intro.md.yml. The PR body states the provenance (source commit, engine version, model), as every round does.
  • translate init copies every non-Markdown file from the English lectures/ folder, even with -f. This PR is the one time to take that copy, as the base for the edits above. Every later round restores what init overwrote (_config.yml, _toc.yml, .translate/config.yml) and drops TRANSLATION-REPORT.md. It then commits the lecture with its state file, plus any new _static asset the lecture uses.
  • No action-translation label on this PR or on any round PR. That label starts the automated review, which fails on hand-opened PRs (Seed PRs have no AI-review path: init has no --github mode and review mode hard-fails on hand-staged seeds action-translation#218).

Pages (repository admin: @mmcky)

The first preview deploy creates the gh-pages branch. Then serve Pages from it, as ml does: branch gh-pages, folder /, default URL, no custom domain.

gh api -X POST repos/QuantEcon/lecture-python-programming.ja/pages -f 'source[branch]=gh-pages' -f 'source[path]=/'

Done when

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

infrastructureSubstantial CI / build / deploy / tooling / automation work, or behaviour-preserving restructuring

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions