File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed
Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- # Loop through all notebooks in the specified directory
4- for nb in notebooks/* .ipynb; do
3+ # Get the conda environment's jupyter path
4+ CONDA_JUPYTER=$( dirname " $( which python) " ) /jupyter
5+
6+ run_notebook () {
7+ local nb=" $1 "
58 echo " 🏃 Running notebook: $nb "
6-
7- # Execute and update the notebook in-place
8- # With some processing to remove metadata created by nbconvert
9- if python -m jupyter nbconvert --to notebook --inplace --execute \
9+ if " ${CONDA_JUPYTER} " nbconvert --to notebook --inplace --execute \
1010 --ClearMetadataPreprocessor.enabled=True \
1111 --ClearMetadataPreprocessor.clear_notebook_metadata=False \
1212 --ClearMetadataPreprocessor.preserve_cell_metadata_mask=" kernelspec" \
13- " $nb " ; then
13+ " $nb "
14+ then
1415 echo " ✅ Successfully processed: $nb "
1516 else
1617 echo " ❌ Error processing: $nb "
1718 fi
18-
1919 echo " -------------------------"
20- done
20+ }
21+
22+ if [[ -n " $1 " ]]; then
23+ run_notebook " $1 "
24+ else
25+ for nb in notebooks/* .ipynb; do
26+ run_notebook " $nb "
27+ done
28+ fi
You can’t perform that action at this time.
0 commit comments