Skip to content

Commit

Permalink
chore(ci): add numpy 2 release candidate to test matrix (#1828)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jhamman authored May 6, 2024
1 parent f44fd09 commit 19a28df
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
python-version: ['3.10', '3.11']
numpy-version: ['1.24', '1.26']
numpy-version: ['1.24', '1.26', '2.0.0rc1']
dependency-set: ["minimal", "optional"]

steps:
Expand All @@ -33,7 +33,8 @@ jobs:
pip install hatch
- name: Set Up Hatch Env
run: |
hatch env create
hatch env create test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }}
hatch env run -e test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} list-env
- name: Run Tests
run: |
hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} run
Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ version.source = "vcs"
build.hooks.vcs.version-file = "src/zarr/_version.py"

[tool.hatch.envs.test]
dependencies = [
"numpy~={matrix:numpy}",
]
extra-dependencies = [
"coverage",
"pytest",
Expand All @@ -108,19 +111,20 @@ features = ["extra"]

[[tool.hatch.envs.test.matrix]]
python = ["3.10", "3.11"]
numpy = ["1.24", "1.26"]
numpy = ["1.24", "1.26", "2.0.0rc1"]
version = ["minimal"]

[[tool.hatch.envs.test.matrix]]
python = ["3.10", "3.11"]
numpy = ["1.24", "1.26"]
numpy = ["1.24", "1.26", "2.0.0rc1"]
features = ["optional"]

[tool.hatch.envs.test.scripts]
run-coverage = "pytest --cov-config=pyproject.toml --cov=pkg --cov=tests"
run = "run-coverage --no-cov"
run-verbose = "run-coverage --verbose"
run-mypy = "mypy src"
list-env = "pip list"

[tool.hatch.envs.docs]
features = ['docs']
Expand Down
4 changes: 2 additions & 2 deletions src/zarr/v2/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ def decode_fill_value(cls, v: Any, dtype: np.dtype, object_codec: Any = None) ->
if v == "NaN":
return np.nan
elif v == "Infinity":
return np.PINF
return np.inf
elif v == "-Infinity":
return np.NINF
return -np.inf
else:
return np.array(v, dtype=dtype)[()]
elif dtype.kind in "c":
Expand Down
4 changes: 2 additions & 2 deletions tests/v2/test_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ def test_encode_decode_array_structured():
def test_encode_decode_fill_values_nan():
fills = (
(np.nan, "NaN", np.isnan),
(np.NINF, "-Infinity", np.isneginf),
(np.PINF, "Infinity", np.isposinf),
(-np.inf, "-Infinity", np.isneginf),
(np.inf, "Infinity", np.isposinf),
)

for v, s, f in fills:
Expand Down

0 comments on commit 19a28df

Please sign in to comment.