File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 1
1
import argparse
2
2
import os
3
3
import re
4
+ import subprocess
4
5
import sys
5
6
from datetime import datetime
6
7
from pathlib import Path
@@ -574,6 +575,20 @@ def clean_table_line(line: str) -> str:
574
575
return line
575
576
576
577
578
+ def strip_notebook_outputs (directory = "." ):
579
+ """Simple function to strip outputs from all notebooks in directory."""
580
+ notebook_files = list (Path (directory ).rglob ("*.ipynb" ))
581
+
582
+ if not notebook_files :
583
+ print ("No notebooks found" )
584
+ return
585
+
586
+ for nb_file in notebook_files :
587
+ subprocess .run (["nbstripout" , str (nb_file )])
588
+
589
+ print (f"Processed { len (notebook_files )} notebooks" )
590
+
591
+
577
592
def main ():
578
593
parser = argparse .ArgumentParser (description = "Build Lamin docs site." )
579
594
aa = parser .add_argument
@@ -705,6 +720,7 @@ def main():
705
720
"bionty.source" ,
706
721
"bionty.tissue" ,
707
722
]
723
+ strip_notebook_outputs (str (docs_dir ))
708
724
build_status = generate_single_markdown_file (
709
725
str (docs_dir ), args .site , filename , skip_patterns = skip_patterns
710
726
)
You can’t perform that action at this time.
0 commit comments