Skip to content

Commit a73b20d

Browse files
authored
Add example notebook (#709)
1 parent 19fb8bf commit a73b20d

File tree

5 files changed

+392
-7
lines changed

5 files changed

+392
-7
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
cache: 'pip'
4242
- name: Install package
4343
run: |
44-
pip install -e .[tests]
44+
pip install -e '.[tests]'
4545
if [ "${{ matrix.pip_opts }}" != "" ]; then
4646
pip install "${{ matrix.pip_opts }}" numba
4747
fi
@@ -65,7 +65,7 @@ jobs:
6565
cache: 'pip'
6666
- name: Install package
6767
run: |
68-
pip install -e .[docs]
68+
pip install -e '.[docs]'
6969
- name: Run tests
7070
run: |
7171
sphinx-build -W -b html docs/ _build/html
@@ -103,10 +103,26 @@ jobs:
103103
- name: Build and install Sparse
104104
run: |
105105
pip install -U setuptools wheel
106-
python -m pip install '.[finch]' scipy
106+
pip install '.[finch]' scipy
107107
- name: Run examples
108108
run: |
109109
source ci/test_examples.sh
110+
notebooks:
111+
runs-on: ubuntu-latest
112+
steps:
113+
- name: Checkout Repo
114+
uses: actions/checkout@v4
115+
- name: Set up Python
116+
uses: actions/setup-python@v5
117+
with:
118+
python-version: '3.11'
119+
cache: 'pip'
120+
- name: Build and install Sparse
121+
run: |
122+
pip install -e '.[notebooks]'
123+
- name: Run notebooks
124+
run: |
125+
source ci/test_notebooks.sh
110126
array_api_tests:
111127
strategy:
112128
matrix:
@@ -130,10 +146,10 @@ jobs:
130146
cache: 'pip'
131147
- name: Install build and test dependencies from PyPI
132148
run: |
133-
python -m pip install pytest-xdist -r array-api-tests/requirements.txt
149+
pip install pytest-xdist -r array-api-tests/requirements.txt
134150
- name: Build and install Sparse
135151
run: |
136-
python -m pip install '.[finch]'
152+
pip install '.[finch]'
137153
- name: Run the test suite
138154
env:
139155
ARRAY_API_TESTS_MODULE: sparse

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ repos:
1515
- id: no-commit-to-branch
1616
- id: pretty-format-json
1717
args: ["--autofix", "--no-ensure-ascii"]
18+
exclude: ".ipynb"
1819

1920
- repo: https://github.com/astral-sh/ruff-pre-commit
2021
rev: v0.4.10
@@ -24,3 +25,8 @@ repos:
2425
types_or: [ python, pyi, jupyter ]
2526
- id: ruff-format
2627
types_or: [ python, pyi, jupyter ]
28+
29+
- repo: https://github.com/kynan/nbstripout
30+
rev: 0.7.1
31+
hooks:
32+
- id: nbstripout

ci/test_notebooks.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CI_MODE=True pytest -n 4 --nbmake --nbmake-timeout=600 ./examples/*.ipynb

0 commit comments

Comments
 (0)