mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-06 09:38:33 -05:00
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/harvard-edge/cs249r_book/pull/1420
Author: @profvjreddi
Created: 4/20/2026
Status: ✅ Merged
Merged: 4/20/2026
Merged by: @profvjreddi
Base:
dev← Head:fix/quarto-mlsysim-pythonpath📝 Commits (2)
7022d88fix(tests): make mlsysim.core importable from CI without pip install0d1ff6cfix(quarto): restore mlsysim importability after PR #1397 outer-init removal📊 Changes
6 files changed (+20 additions, -9 deletions)
View changed files
📝
book/quarto/config/_quarto-pdf-vol1-copyedit.yml(+1 -1)📝
book/quarto/config/_quarto-pdf-vol1.yml(+1 -1)📝
book/quarto/config/_quarto-pdf-vol2-copyedit.yml(+1 -1)📝
book/quarto/config/_quarto-pdf-vol2.yml(+1 -1)📝
book/quarto/config/shared/base/execute-env.yml(+1 -1)📝
book/tests/test_units.py(+15 -4)📄 Description
Summary
One-line fix to 5 Quarto config files. Same root cause as #1419 (
test_units.pypath bug),different surface area: the actual book content. Unblocks the Container Build Matrix on
book-validate-dev, which has been failing since PR #1419 exposed it.What broke
Quarto's execute env sets:
```yaml
execute:
env:
PYTHONPATH: "../.." # = repo root
```
The .qmd Python chunks then do `from mlsysim.core.constants import *`. That worked because
there used to be an outer `mlsysim/init.py` that made `<repo_root>/mlsysim/` a real
Python package — even though the actual package is one level deeper at
`<repo_root>/mlsysim/mlsysim/`. PR #1397 ("MLSys·im 0.1.0 release-prep audit") cleaned up
that nested-with-same-name layout (correct packaging hygiene), and the .qmd imports stopped
resolving with `ModuleNotFoundError: No module named 'mlsysim.core'`.
Why it stayed hidden for 3 days
`book-validate-dev` was already red on the `book-mlsys-test-units` pre-commit hook
(fixed in #1419). Because the Container Build Matrix depends on Pre-commit Checks passing,
every container job was SKIPPED, not RUN. The moment #1419 made pre-commit green, the
matrix actually executed and surfaced this second failure on the same root cause.
Blast radius
Roughly 15 vol1 chapters and a similar count in vol2 import `mlsysim.core` directly in
Python chunks (`benchmarking`, `nn_architectures`, `hw_acceleration`, `model_serving`,
`training`, `ml_ops`, `responsible_engr`, `introduction`, …). This affects every
HTML / PDF / EPUB build for both volumes.
Fix
Prepend `<repo_root>/mlsysim/` (where the real package lives) to PYTHONPATH:
```yaml
PYTHONPATH: "../..:../../mlsysim"
```
Applied to all 5 config files that duplicate the PYTHONPATH line:
The original `../..` entry is preserved in case any existing import relies on repo-root scope.
Verification
Emulated the Quarto execution context locally:
```
cd book/quarto && PYTHONPATH="../..:../../mlsysim" python3 -c \
'from mlsysim import Hardware, Models; from mlsysim.core.constants import *'
```
Resolves cleanly; `Hardware` comes from `mlsysim.hardware.registry`.
What this unblocks
`book-validate-dev` going green for the first time since 2026-04-17 → publish guard
`infra-publish-guard.yml` re-armed → `book-publish-live` becomes triggerable for vol1
v0.6.0 / vol2 v0.1.0 (B3–B6 of the staged-rollout plan).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.