From 8cbc503e9420f753f92fb88d8db0fe5b49979b0a Mon Sep 17 00:00:00 2001 From: Aniket Singh Yadav Date: Sun, 14 Sep 2025 09:44:20 +0530 Subject: [PATCH] Add Jupyter notebook format check using nbstripout --- scripts/format_check.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/format_check.sh b/scripts/format_check.sh index 1d91427e0..d9e87183d 100755 --- a/scripts/format_check.sh +++ b/scripts/format_check.sh @@ -91,6 +91,22 @@ else exit 1 fi +# Check Jupyter Notebook format +echo "Checking Jupyter Notebook format..." +if ! command -v nbstripout &> /dev/null +then + echo "nbstripout could not be found, please install it with 'pip install nbstripout'" + exit 1 +fi + +for notebook in $(find . -name "*.ipynb"); do + nbstripout --check "$notebook" + if [ $? -ne 0 ]; then + echo "Notebook $notebook is not in the correct format. Please strip output and metadata." + exit 1 + fi +done + echo "Checking C++ formatting..."; formatting_outputs=$(find tensorflow_quantum/ -iname *.h -o -iname *.cc | xargs clang-format -style=google -output-replacements-xml); CFORMATCHECK=0