Skip to content

Commit 4800629

Browse files
committed
Format fixes
1 parent 1dd2fce commit 4800629

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

.github/workflows/render.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,33 @@ jobs:
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

0 commit comments

Comments
 (0)