File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change 3232 # - uses: actions/setup-python@v5
3333 # with: { python-version: '3.11' }
3434 # - run: pip install -r requirements.txt
35-
35+ - name : Normalize notebooks for Quarto
36+ run : |
37+ pip install nbformat
38+ python3 - << 'EOF'
39+ import glob, nbformat
40+
41+ for path in glob.glob("**/*.ipynb", recursive=True):
42+ nb = nbformat.read(path, as_version=4)
43+ changed = False
44+
45+ # 1) strip out the VSCode cell “id” field
46+ for cell in nb.cells:
47+ if cell.get("id", None) is not None:
48+ cell.pop("id", None)
49+ changed = True
50+
51+ # 2) force a known kernel
52+ ks = nb.metadata.get("kernelspec", {})
53+ if ks.get("name") != "python3":
54+ nb.metadata["kernelspec"] = {
55+ "name":"python3", "display_name":"Python 3", "language":"python"
56+ }
57+ changed = True
58+
59+ if changed:
60+ nbformat.write(nb, path)
61+ EOF
3662 # ===== Render the site =====
3763 - name : Render
3864 run : quarto render
You can’t perform that action at this time.
0 commit comments