Skip to content

Commit 1215494

Browse files
committed
misc: Add script to clean notebooks
1 parent 963f6b2 commit 1215494

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

scripts/clean_notebooks.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
# Clean your notebooks!
4+
5+
# Clear all the output from all cells
6+
jupyter-nbconvert --clear-output $@
7+
8+
# Run the whole notebook in order from start to end
9+
## We don't run with --ClearMetadataPreprocessor.enabled=True
10+
## as this is used to tag cells where nbval should skip checking
11+
jupyter-nbconvert \
12+
--execute \
13+
--allow-errors \
14+
--to notebook \
15+
--inplace \
16+
$@
17+
18+
# Strip superfluous metadata
19+
## NB: may need more extra-keys, these are just the current offenders
20+
nbstripout \
21+
--keep-output \
22+
--keep-count \
23+
--extra-keys='cell.metadata.editable cell.metadata.slideshow' \
24+
$@

0 commit comments

Comments
 (0)