Skip to content

Commit 38ef149

Browse files
authored
💚 fix CI numpy testing matrix (#778)
2 parents 60f2186 + 2601a89 commit 38ef149

File tree

2 files changed

+59
-52
lines changed

2 files changed

+59
-52
lines changed

‎.github/workflows/ci.yml

Lines changed: 57 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
with:
4040
activate-environment: true
4141
python-version: "3.13"
42-
version: "0.8.3"
4342

4443
- name: ruff
4544
run: |
@@ -50,75 +49,83 @@ jobs:
5049
- name: pyright
5150
uses: jakebailey/[email protected]
5251

53-
generate-matrix:
54-
name: Generate Test Matrix
52+
# NOTE: mypy ignores `uv run --with=...` (and `--isolated` does not help), so we
53+
# manually (re)install the desired version directly in the environment.
54+
55+
typecheck:
5556
runs-on: ubuntu-latest
56-
timeout-minutes: 1
57+
timeout-minutes: 5
5758

58-
outputs:
59-
matrix: ${{ steps.set-matrix.outputs.matrix }}
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
py: ["3.11"]
63+
np: ["1.25", "2.0", "2.1", "2.2", "2.3"]
6064

6165
steps:
6266
- uses: actions/[email protected]
6367

64-
- uses: astral-sh/[email protected]
68+
- name: setup uv
69+
uses: astral-sh/[email protected]
6570
with:
66-
python-version: "3.13"
67-
version: "0.8.3"
71+
activate-environment: true
72+
python-version: ${{ matrix.py }}
6873

69-
- name: Generate Matrix
70-
id: set-matrix
71-
shell: bash
72-
run: |
73-
matrix=$(uv run scripts/generate_matrix.py | jq -c)
74-
echo "matrix=$matrix" >> $GITHUB_OUTPUT
74+
- name: sync env
75+
run: uv sync --no-editable
76+
77+
- name: install specific numpy version
78+
run: >
79+
uv pip install --upgrade
80+
"numpy==${{ matrix.np }}.*"
81+
"numpy-typing-compat==${{ matrix.np }}.*"
82+
83+
- name: basedpyright scipy-stubs
84+
run: basedpyright scipy-stubs
85+
86+
- name: mypy scipy-stubs
87+
run: mypy --no-incremental --cache-dir=/dev/null scipy-stubs
88+
89+
- name: stubtest scipy
90+
run: stubtest --allowlist=.mypyignore scipy
7591

7692
typetest:
77-
needs: generate-matrix
93+
# needs: generate-matrix
7894
runs-on: ubuntu-latest
79-
timeout-minutes: 3
95+
timeout-minutes: 5
8096

8197
strategy:
8298
fail-fast: false
83-
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
99+
matrix:
100+
py: ["3.11", "3.12", "3.13"]
101+
np: ["1.25", "2.0", "2.1", "2.2", "2.3"]
102+
exclude:
103+
- py: "3.12"
104+
np: "1.25"
105+
- py: "3.13"
106+
np: "1.25"
107+
- py: "3.13"
108+
np: "2.0"
84109

85110
steps:
86111
- uses: actions/[email protected]
87112

88113
- uses: astral-sh/[email protected]
89114
with:
90-
python-version: ${{ matrix.python }}
91-
version: "0.8.3"
115+
activate-environment: true
116+
python-version: ${{ matrix.py }}
92117

93-
- name: basedpyright
94-
run: >
95-
uv run
96-
-p ${{ matrix.python }}
97-
--with="numpy==${{ matrix.numpy }}"
98-
--no-editable
99-
basedpyright
118+
- name: sync env
119+
run: uv sync --no-editable
100120

101-
- name: mypy
102-
run: >
103-
uv run
104-
-p ${{ matrix.python }}
105-
--with="numpy==${{ matrix.numpy }}"
106-
--no-editable
107-
mypy
108-
--tb
109-
--hide-error-context
110-
--hide-error-code-links
111-
--no-incremental
112-
--cache-dir=/dev/null
113-
--soft-error-limit=-1
114-
.
115-
116-
- name: stubtest
121+
- name: install specific numpy version
117122
run: >
118-
uv run
119-
-p ${{ matrix.python }}
120-
--with="numpy==${{ matrix.numpy }}"
121-
--no-editable
122-
stubtest
123-
--allowlist=.mypyignore
124-
scipy
123+
uv pip install --upgrade
124+
"numpy==${{ matrix.np }}.*"
125+
"numpy-typing-compat==${{ matrix.np }}.*"
126+
127+
- name: basedpyright tests
128+
run: basedpyright tests
129+
130+
- name: mypy tests
131+
run: mypy --no-incremental --cache-dir=/dev/null --soft-error-limit=-1 tests

‎tests/integrate/test_solve_ivp.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ from scipy.integrate import solve_ivp
88

99
_VecF64: TypeAlias = np.ndarray[tuple[int], np.dtype[np.float64]]
1010
_MatF64: TypeAlias = np.ndarray[tuple[int, int], np.dtype[np.float64]]
11-
_ArrF64: TypeAlias = np.ndarray[tuple[int, ...], np.dtype[np.float64]]
12-
_VecC128: TypeAlias = np.ndarray[tuple[Any], np.dtype[np.complex128]]
11+
_ArrF64: TypeAlias = np.ndarray[tuple[Any, ...], np.dtype[np.float64]]
12+
_VecC128: TypeAlias = np.ndarray[tuple[int], np.dtype[np.complex128]]
1313
_MatC128: TypeAlias = np.ndarray[tuple[int, int], np.dtype[np.complex128]]
1414
_ArrC128: TypeAlias = np.ndarray[tuple[Any, ...], np.dtype[np.complex128]]
1515

0 commit comments

Comments
 (0)