[PR #1420] [MERGED] fix(quarto): restore mlsysim importability after PR #1397 outer-init removal #9091

Closed
opened 2026-05-03 01:19:50 -05:00 by GiteaMirror · 0 comments
Owner

📋 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: devHead: fix/quarto-mlsysim-pythonpath


📝 Commits (2)

  • 7022d88 fix(tests): make mlsysim.core importable from CI without pip install
  • 0d1ff6c fix(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.py path 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:

  • `book/quarto/config/shared/base/execute-env.yml` (HTML; the one that matters most)
  • `book/quarto/config/_quarto-pdf-vol1.yml`
  • `book/quarto/config/_quarto-pdf-vol1-copyedit.yml`
  • `book/quarto/config/_quarto-pdf-vol2.yml`
  • `book/quarto/config/_quarto-pdf-vol2-copyedit.yml`

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.

## 📋 Pull Request Information **Original PR:** https://github.com/harvard-edge/cs249r_book/pull/1420 **Author:** [@profvjreddi](https://github.com/profvjreddi) **Created:** 4/20/2026 **Status:** ✅ Merged **Merged:** 4/20/2026 **Merged by:** [@profvjreddi](https://github.com/profvjreddi) **Base:** `dev` ← **Head:** `fix/quarto-mlsysim-pythonpath` --- ### 📝 Commits (2) - [`7022d88`](https://github.com/harvard-edge/cs249r_book/commit/7022d88dbb844238bf9f66e2c7b0dbe4ecd63c1b) fix(tests): make mlsysim.core importable from CI without pip install - [`0d1ff6c`](https://github.com/harvard-edge/cs249r_book/commit/0d1ff6cc59a428387886a6222f9e459dcf93b1a8) fix(quarto): restore mlsysim importability after PR #1397 outer-init removal ### 📊 Changes **6 files changed** (+20 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `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) </details> ### 📄 Description ## Summary One-line fix to 5 Quarto config files. Same root cause as #1419 (`test_units.py` path 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: - \`book/quarto/config/shared/base/execute-env.yml\` (HTML; the one that matters most) - \`book/quarto/config/_quarto-pdf-vol1.yml\` - \`book/quarto/config/_quarto-pdf-vol1-copyedit.yml\` - \`book/quarto/config/_quarto-pdf-vol2.yml\` - \`book/quarto/config/_quarto-pdf-vol2-copyedit.yml\` 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). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-03 01:19:50 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#9091