Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): add numpy 2 release candidate to test matrix #1828

Merged
merged 7 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}",
]
Comment on lines +95 to +97
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was what we were missing. Eeek!

extra-dependencies = [
"coverage",
"pytest",
Expand All @@ -107,19 +110,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"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is used in the test github action


[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
Loading