Skip to content

Commit cb938af

Browse files
committed
Fixes removing tags metadata from notebook cells
1 parent 90bce69 commit cb938af

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tools/prepare_notebooks.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,17 @@ def ensure_bootstrap(nb) -> bool:
7979

8080
def process_notebook(path: Path) -> int:
8181
nb = nbformat.read(path, as_version=4)
82-
changed = 0
83-
if ensure_bootstrap(nb):
84-
changed += 1
8582

83+
# Remove all 'tags' metadata from cells
8684
for cell in nb.cells:
8785
if 'tags' in cell.metadata:
8886
cell.metadata.pop('tags')
8987

88+
# Add the bootstrap cell if needed
89+
changed = 0
90+
if ensure_bootstrap(nb):
91+
changed += 1
92+
9093
# Normalize to ensure cell ids exist and structure is valid
9194
if changed or any('id' not in c for c in nb.cells):
9295
normalize(nb)

0 commit comments

Comments
 (0)