Repository navigation
Description
Speed up container-mode setup-environment by avoiding a fresh package install every run. Scope is now narrow: only the per-lecture environment-update delta install is uncached, and no consumer pays for it today.
The common stack is pre-baked on the Anaconda 2026.06 baseline (containers/quantecon/environment.yml:11; lean-image pins at containers/quantecon-build/environment.yml:20-29), reaching consumers via the image tag, not the v0.9.0 release. Undone is the literal ask: analyse packages common across the lecture repos and add them to quantecon-build. containers/quantecon-build/environment.yml:3 still routes every lecture-specific package (quantecon, wbgapi, jax) to the lecture repo's own environment file; that delta install is the whole remaining scope.
The default path is zero-cost: environment-update defaults to '' (setup-environment/action.yml:17) and container mode runs a no-op (setup-environment/action.yml:85-93), shipped in v0.5.0. No consumer passes it — QuantEcon/lecture-dp's ci.yml and cache.yml do not — and the #92 baseline below shows no delta install among the costs.
actions/cache can see /opt/conda — under container: every step runs inside the container, JS actions included — so isolation was never the obstacle. The real obstacles, hit by the #100 harness in standard mode: tar ownership/permissions on restore (setup-environment/action.yml:122-127), and restoring a cached env over the image's own. The workspace-copy workaround (into .cache/, back over site-packages) is out; the pip-download-cache and mounted-volume variants need re-deriving from these. Two shipped comments still assert the wrong rationale (Conda env outside the workspace mount, actions/cache on the host) and link back here.
Next steps
-
Pre-bake the common stack into the container images— done in Migrate both containers to the Anaconda 2026.06 baseline #95 (v0.9.0) -
Profile current build times to establish a baseline— done for the container path in Optimize preview builds: phased plan for the fastest PR previews (tracking) #92: warmlecture-dp~2.7 min, container pull 129s, HTML 22s, cache restore 3s - Correct that rationale (
setup-environment/action.yml:62-66,setup-environment/README.md:126) and the unmeasured ~30-60s figure (setup-environment/README.md:127), regardless of later measurement; can ride fix(actions): batch of small correctness fixes across the seven actions #107, which fixes the missing-nin the same step (setup-environment/action.yml:77) - Revisit only once a repo adopts an
environment-updatefile and there is a measured cost - If worth attacking, prefer baking the near-universal delta packages into the image over caching them
Keep open at low priority, per PLAN.md:115. Origin: PR #17, container-aware setup-environment. #107 (conda env update without -n, wrong env) lands before any work here; #92 has the measured preview-build baselines.
Activity
fix: address round 2 PR review feedback
feat: container-aware setup-environment with lean container variant (#17
quantecon-services commentedon Sep 24, 2026
Triage note, 2026-09-24: this issue's "correct the rationale shipped in the code comments" item was meant to ride with #107. #107 closed on 2026-09-24 without it. The wrong text is still at
setup-environment/action.yml:61-67("env outside workspace mount", "actions/cache on host", the unmeasured ~30–60 s) and atsetup-environment/README.md:9and:126-127. That correction is small and needn't wait for the rest of this low-priority issue.Generated by Claude Code
mmcky commentedon Nov 6, 2026
Checked against
mainat9644f17(2026-11-06). Two of the three wrong texts are gone:setup-environment/README.mdis now a generated signpost, and neither its rationale nor the "~30-60 s" figure survives anywhere. The setup-environment chapter now states it correctly: in container mode a delta is installed afresh on every run (docs/user/actions/setup-environment.md:142). The third remains, the comment atsetup-environment/action.yml:118-125, which still says the Conda environment "lives outside the workspace mount, so actions/cache cannot persist it". The images are on the Anaconda 2026.07 baseline now, not 2026.06.The rest still has no consumer. An org-wide code search finds no workflow outside this repository that passes
environment-update. The one measurement, the harness'senv-container-updatejob in run 42210229573, took 13 s to install a one-package pip delta into the lean image, against 89 s to pull the image. Two merges since make the remedies easier: #245 builds and smoke-tests an image change on its pull request, so baking a common package such asquanteconinto the images is a tested change; and #255 stopped the scheduled rebuilds, so a cache keyed on the image's digest would stay valid until the next image merge.Proposed: fix the comment now, as a one-commit change with no release of its own, saying that container mode caches nothing, and that a restored environment would be several GB and would mix with the image's own (#209). Keep this issue parked with a trigger: when a repository first passes
environment-update(most likelylecture-python.myst's full chain, for its ML libraries), time itssetup-environmentstep and its image pull. If the delta is a large share of the run, prefer baking its common packages into the images, then a pip and Conda download cache keyed on the image digest and the delta file, and only last a cache of the environment itself.Claude Code (on behalf of mmcky)
docs(setup-environment): give the real reason container mode caches n…
release: v0.16.0 (#278)