mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-07-21 00:23:30 -05:00
Fix Linux book render Python path
This commit is contained in:
@@ -440,14 +440,11 @@ jobs:
|
||||
- name: 🧪 Preflight toolchain (Linux)
|
||||
if: matrix.platform == 'linux' && matrix.enabled
|
||||
working-directory: ${{ vars.BOOK_QUARTO }}
|
||||
env:
|
||||
# Layout: <repo>/mlsysim/ is the project dir; <repo>/mlsysim/mlsysim/
|
||||
# is the actual Python package. Put the project dir on PYTHONPATH so
|
||||
# submodule imports like `mlsysim.core` resolve without an editable
|
||||
# install. Parallels the fix in book/tests/test_units.py.
|
||||
PYTHONPATH: ${{ github.workspace }}/mlsysim:${{ github.workspace }}
|
||||
run: |
|
||||
set -eu
|
||||
# In GitHub's Linux container jobs, $GITHUB_WORKSPACE is the in-container
|
||||
# checkout path. The github.workspace expression is the host path.
|
||||
export PYTHONPATH="$GITHUB_WORKSPACE/mlsysim:$GITHUB_WORKSPACE${PYTHONPATH:+:$PYTHONPATH}"
|
||||
echo "🧪 Running Linux toolchain preflight checks..."
|
||||
run_check() {
|
||||
CHECK_NAME="$1"
|
||||
@@ -468,6 +465,7 @@ jobs:
|
||||
run_check "python3 on PATH" "command -v python3 >/dev/null"
|
||||
run_check "python3 version" "python3 --version"
|
||||
run_check "mlsysim import" "python3 -c \"import mlsysim,sys; print('mlsysim:', mlsysim.__file__); print('python:', sys.executable)\""
|
||||
run_check "book tools import" "python3 -c \"from book.tools.figures import style; print('book.tools.figures:', style.__file__)\""
|
||||
run_check "mlsysim.core import" "python3 -c \"import mlsysim.core; print('mlsysim.core:', mlsysim.core.__file__)\""
|
||||
run_check "Rscript on PATH" "command -v Rscript >/dev/null"
|
||||
run_check "Rscript version" "Rscript --version | sed -n '1p'"
|
||||
@@ -594,11 +592,10 @@ jobs:
|
||||
if: matrix.platform == 'linux' && matrix.enabled
|
||||
working-directory: ${{ vars.BOOK_QUARTO }}
|
||||
env:
|
||||
# See preflight comment: <repo>/mlsysim/ must be on PYTHONPATH so
|
||||
# Quarto's embedded Python can resolve `mlsysim.core` during render.
|
||||
PYTHONPATH: ${{ github.workspace }}/mlsysim:${{ github.workspace }}
|
||||
CHROMIUM_FLAGS: "--no-sandbox"
|
||||
run: |
|
||||
# Keep the in-container checkout first on PYTHONPATH for render-time imports.
|
||||
export PYTHONPATH="$GITHUB_WORKSPACE/mlsysim:$GITHUB_WORKSPACE${PYTHONPATH:+:$PYTHONPATH}"
|
||||
# Ensure Quarto can find Chromium (installed by Dockerfile but .bashrc not sourced in CI)
|
||||
if [ -f "$HOME/.local/share/quarto/chromium/chrome" ]; then
|
||||
export QUARTO_CHROMIUM="$HOME/.local/share/quarto/chromium/chrome"
|
||||
|
||||
@@ -117,7 +117,7 @@ bibliography:
|
||||
|
||||
execute:
|
||||
env:
|
||||
PYTHONPATH: "../..:../../mlsysim"
|
||||
PYTHONPATH: "../..:../../mlsysim:../../../../..:../../../../../mlsysim"
|
||||
MPLBACKEND: "Agg"
|
||||
|
||||
metadata-files:
|
||||
|
||||
@@ -138,7 +138,7 @@ metadata-files:
|
||||
|
||||
execute:
|
||||
env:
|
||||
PYTHONPATH: "../..:../../mlsysim"
|
||||
PYTHONPATH: "../..:../../mlsysim:../../../../..:../../../../../mlsysim"
|
||||
MPLBACKEND: "Agg"
|
||||
|
||||
editor:
|
||||
|
||||
@@ -119,7 +119,7 @@ bibliography:
|
||||
|
||||
execute:
|
||||
env:
|
||||
PYTHONPATH: "../..:../../mlsysim"
|
||||
PYTHONPATH: "../..:../../mlsysim:../../../../..:../../../../../mlsysim"
|
||||
MPLBACKEND: "Agg"
|
||||
|
||||
metadata-files:
|
||||
|
||||
@@ -141,7 +141,7 @@ metadata-files:
|
||||
|
||||
execute:
|
||||
env:
|
||||
PYTHONPATH: "../..:../../mlsysim"
|
||||
PYTHONPATH: "../..:../../mlsysim:../../../../..:../../../../../mlsysim"
|
||||
MPLBACKEND: "Agg"
|
||||
|
||||
editor:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
execute:
|
||||
env:
|
||||
PYTHONPATH: "../..:../../mlsysim"
|
||||
PYTHONPATH: "../..:../../mlsysim:../../../../..:../../../../../mlsysim"
|
||||
MPLBACKEND: "Agg"
|
||||
|
||||
editor:
|
||||
|
||||
Reference in New Issue
Block a user