Skip to content

Commit ff0a208

Browse files
committed
Check outputs of example notebooks in CI.
Check via execution count in a bash script.
1 parent 2bf8bd1 commit ff0a208

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

.github/workflows/ci.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ jobs:
3535
- name: pre-commit
3636
run: pixi run pre-commit-run --color=always --show-diff-on-failure
3737

38-
mypy-example-nbs:
39-
name: Check notebooks mypy
38+
check-example-nbs:
39+
name: Check notebooks mypy and output exists
4040
timeout-minutes: 5
4141
runs-on: ubuntu-latest
4242
steps:
@@ -48,6 +48,7 @@ jobs:
4848
run: |
4949
pixi run nb-convert
5050
pixi run nb-mypy
51+
pixi run nb-assert-output
5152
5253
unit-tests:
5354
name: Unit Tests
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/bin/bash
2+
13
for notebook in docs/examples/*.ipynb; do
24
# Check the notebook for null execution counts
35
if ! jq -e '.cells | map(select(.cell_type == "code") | .execution_count != null) | all' "$notebook" > /dev/null; then
@@ -6,6 +8,5 @@ for notebook in docs/examples/*.ipynb; do
68
fi
79
done
810

9-
# If all notebooks are valid
1011
echo "All notebooks have valid execution counts."
1112
exit 0

pixi.toml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ coverage = "pytest tests --cov=metalearners --cov-report=xml --cov-report term-m
99
# Note that this task will fail on systems without bash.
1010
nb-convert = "nb-convert.sh"
1111
nb-mypy = "mypy docs/examples/*.py"
12+
nb-assert-output = "nb-output-check.sh"
1213

1314
[dependencies]
1415
pre-commit = "*"

0 commit comments

Comments
 (0)