Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:

test-lnx-py37:
test-lnx:
runs-on: ubuntu-latest

steps:
Expand All @@ -29,7 +29,7 @@ jobs:

- name: Testing notebooks
run: |
for f in docs/source/*.ipynb
for f in docs/source/user_guide/*.ipynb
do
jupyter nbconvert --to notebook --inplace --execute $f || (echo "$f" >> failed_nbs.txt)
done
Comment on lines 30 to 35
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Harden the loop against “no match” cases and allow sub-directories

If no notebook matches docs/source/user_guide/*.ipynb, the glob is left literally in $f, and nbconvert fails the job even though there are simply no notebooks.
Activate nullglob (or use find) and optionally recurse into sub-folders:

-        for f in docs/source/user_guide/*.ipynb
+        shopt -s nullglob   # empty globs expand to nothing
+        for f in docs/source/user_guide/**/*.ipynb
         do
           jupyter nbconvert --to notebook --inplace --execute "$f" || (echo "$f" >> failed_nbs.txt)
         done

This avoids false failures and future-proofs the path structure.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Testing notebooks
run: |
for f in docs/source/*.ipynb
for f in docs/source/user_guide/*.ipynb
do
jupyter nbconvert --to notebook --inplace --execute $f || (echo "$f" >> failed_nbs.txt)
done
- name: Testing notebooks
run: |
shopt -s nullglob # empty globs expand to nothing
for f in docs/source/user_guide/**/*.ipynb
do
jupyter nbconvert --to notebook --inplace --execute "$f" || (echo "$f" >> failed_nbs.txt)
done
🤖 Prompt for AI Agents
In .github/workflows/test-notebooks.yml around lines 30 to 35, the shell loop
over notebooks fails if no files match the glob pattern, causing false failures.
To fix this, enable the shell option `nullglob` before the loop to ensure the
glob expands to an empty list if no matches exist, preventing the loop from
running with a literal pattern. Additionally, modify the loop to recursively
find notebooks in subdirectories, for example by using `find` with appropriate
path and extension filters, so it covers all notebooks under the directory tree.

Expand Down