Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/scripts/run_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ def execute_notebook(nb_path: Path, env: dict) -> tuple[int, str]:
# Write the executed copy to a throwaway path so the on-disk notebook
# under notebooks/ is never modified — checked-in notebooks stay clean.
tmp_dir = Path(tempfile.mkdtemp(prefix="smoke_nb_"))
# `jupyter nbconvert --execute` runs the kernel in the *notebook's own
# directory*, but the workspace convention (and the script smoke, which runs
# with cwd=WORKSPACE) is that relative `dataset/` paths resolve from the repo
# root. Stage a temporary copy of the notebook at the workspace root so the
# kernel's working directory is the root and root-relative paths resolve.
staged = WORKSPACE / f".smoke_run_{os.getpid()}_{nb_path.name}"
shutil.copyfile(nb_path, staged)
try:
result = subprocess.run(
[
Expand All @@ -113,14 +120,15 @@ def execute_notebook(nb_path: Path, env: dict) -> tuple[int, str]:
str(tmp_dir),
"--output",
nb_path.name,
str(nb_path),
str(staged),
],
cwd=str(WORKSPACE),
env=env,
capture_output=True,
text=True,
)
finally:
staged.unlink(missing_ok=True)
shutil.rmtree(tmp_dir, ignore_errors=True)
return result.returncode, result.stdout + result.stderr

Expand Down
Loading