Skip to content

Commit 19a28df

Browse files
authored
chore(ci): add numpy 2 release candidate to test matrix (#1828)
* chore(ci): add numpy 2 release candidate to test matrix * also add to pyproject.toml * list env in ci * specify numpy in matrix deps * add list-env * use np.inf * more inf fixes
1 parent f44fd09 commit 19a28df

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
matrix:
1919
python-version: ['3.10', '3.11']
20-
numpy-version: ['1.24', '1.26']
20+
numpy-version: ['1.24', '1.26', '2.0.0rc1']
2121
dependency-set: ["minimal", "optional"]
2222

2323
steps:
@@ -33,7 +33,8 @@ jobs:
3333
pip install hatch
3434
- name: Set Up Hatch Env
3535
run: |
36-
hatch env create
36+
hatch env create test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }}
37+
hatch env run -e test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} list-env
3738
- name: Run Tests
3839
run: |
3940
hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} run

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ version.source = "vcs"
9292
build.hooks.vcs.version-file = "src/zarr/_version.py"
9393

9494
[tool.hatch.envs.test]
95+
dependencies = [
96+
"numpy~={matrix:numpy}",
97+
]
9598
extra-dependencies = [
9699
"coverage",
97100
"pytest",
@@ -108,19 +111,20 @@ features = ["extra"]
108111

109112
[[tool.hatch.envs.test.matrix]]
110113
python = ["3.10", "3.11"]
111-
numpy = ["1.24", "1.26"]
114+
numpy = ["1.24", "1.26", "2.0.0rc1"]
112115
version = ["minimal"]
113116

114117
[[tool.hatch.envs.test.matrix]]
115118
python = ["3.10", "3.11"]
116-
numpy = ["1.24", "1.26"]
119+
numpy = ["1.24", "1.26", "2.0.0rc1"]
117120
features = ["optional"]
118121

119122
[tool.hatch.envs.test.scripts]
120123
run-coverage = "pytest --cov-config=pyproject.toml --cov=pkg --cov=tests"
121124
run = "run-coverage --no-cov"
122125
run-verbose = "run-coverage --verbose"
123126
run-mypy = "mypy src"
127+
list-env = "pip list"
124128

125129
[tool.hatch.envs.docs]
126130
features = ['docs']

src/zarr/v2/meta.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ def decode_fill_value(cls, v: Any, dtype: np.dtype, object_codec: Any = None) ->
217217
if v == "NaN":
218218
return np.nan
219219
elif v == "Infinity":
220-
return np.PINF
220+
return np.inf
221221
elif v == "-Infinity":
222-
return np.NINF
222+
return -np.inf
223223
else:
224224
return np.array(v, dtype=dtype)[()]
225225
elif dtype.kind in "c":

tests/v2/test_meta.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ def test_encode_decode_array_structured():
325325
def test_encode_decode_fill_values_nan():
326326
fills = (
327327
(np.nan, "NaN", np.isnan),
328-
(np.NINF, "-Infinity", np.isneginf),
329-
(np.PINF, "Infinity", np.isposinf),
328+
(-np.inf, "-Infinity", np.isneginf),
329+
(np.inf, "Infinity", np.isposinf),
330330
)
331331

332332
for v, s, f in fills:

0 commit comments

Comments
 (0)