Skip to content

Commit dd01407

Browse files
authored
Merge pull request #441 from xarray-contrib/prepare-v0.0.28
Prepare release v0.0.28, pin numpy below v2.4
2 parents f10a495 + 2332c41 commit dd01407

9 files changed

Lines changed: 50 additions & 21 deletions

File tree

.pre-commit-config.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ci:
99
autofix_prs: true
1010
autoupdate_branch: ""
1111
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
12-
autoupdate_schedule: quarterly
12+
autoupdate_schedule: 'quarterly'
1313
skip: []
1414
submodules: false
1515

@@ -24,17 +24,17 @@ repos:
2424
- id: check-merge-conflict
2525
- id: check-toml
2626
- id: check-yaml
27-
args: ["--allow-multiple-documents"]
27+
args: [ "--allow-multiple-documents" ]
2828
- id: debug-statements
2929
- id: end-of-file-fixer
3030
- id: no-commit-to-branch
3131
- id: pretty-format-json
32-
args: ["--autofix", "--no-ensure-ascii", "--no-sort-keys"]
32+
args: [ "--autofix", "--no-ensure-ascii", "--no-sort-keys" ]
3333
exclude: ".ipynb|asv.conf.json"
3434
- id: trailing-whitespace
3535

3636
- repo: https://github.com/astral-sh/ruff-pre-commit
37-
rev: "v0.13.3"
37+
rev: "v0.14.13"
3838
hooks:
3939
- id: ruff-check
4040
args: [ "--fix" ]
@@ -43,10 +43,10 @@ repos:
4343
types_or: [python, pyi, jupyter]
4444

4545
- repo: https://github.com/keewis/blackdoc
46-
rev: v0.4.3
46+
rev: v0.4.6
4747
hooks:
4848
- id: blackdoc
49-
additional_dependencies: ["black==25.1.0"]
49+
additional_dependencies: [ 'black==25.9.0' ]
5050

5151
- repo: https://github.com/PyCQA/doc8
5252
rev: v2.0.0
@@ -62,23 +62,23 @@ repos:
6262
]
6363

6464
- repo: https://github.com/pre-commit/mirrors-mypy
65-
rev: "v1.18.2"
65+
rev: "v1.19.1"
6666
hooks:
6767
- id: mypy
6868
exclude: "asv_bench"
6969
additional_dependencies: [
7070
# Type stubs
71-
types-python-dateutil,
72-
types-setuptools,
73-
types-PyYAML,
74-
types-pytz,
75-
typing-extensions,
71+
'types-python-dateutil',
72+
'types-setuptools',
73+
'types-PyYAML',
74+
'types-pytz',
75+
'typing-extensions',
7676
# Dependencies that are typed
77-
numpy,
77+
'numpy',
7878
]
7979

8080
- repo: https://github.com/python-jsonschema/check-jsonschema
81-
rev: 0.34.0
81+
rev: 0.36.0
8282
hooks:
8383
- id: check-github-workflows
8484
- id: check-readthedocs

CHANGELOG.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@ Changelog History
33
=================
44

55

6+
xskillscore v0.0.28 (2025-01-19)
7+
--------------------------------
8+
9+
Bug Fixes
10+
~~~~~~~~~
11+
- Fixed a bug introduced in v0.0.27 where `numpy` v1.x support was broken for some
12+
algorithms. (:pr:`431`) `Trevor James Smith`_.
13+
- Removed all `numpy.atleast_1d()` calls that were causing numerical differences in
14+
p-value calculations with `numpy` v2.x and fixed several doctest expected outputs.
15+
(:pr:`440`) `Aaron Spring`_.
16+
17+
Internal Changes
18+
~~~~~~~~~~~~~~~~
19+
- Pinned `numpy` below v2.4 due to breaking API changes. (:pr:`441`) `Trevor James Smith`_
20+
- Adjusted tests to adapt to new `xarray` attributes preservation
21+
behaviour. (:pr:`441`) `Trevor James Smith`_
22+
623
xskillscore v0.0.27 (2025-07-14)
724
--------------------------------
825

ci/dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
- cftime
1919
- dask-core >=2023.4.0
2020
- numba >=0.57
21-
- numpy >=1.24
21+
- numpy >=1.24,<2.4
2222
- properscoring
2323
- scikit-learn
2424
- scipy >=1.10.0

ci/doc.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ dependencies:
1212
- ipython
1313
- matplotlib-base
1414
- nbsphinx
15-
- numpy >=1.24
15+
- numba >=0.57
16+
- numpy >=1.24,<2.4
1617
- properscoring
1718
- scikit-learn
1819
- scipy >=1.10

ci/docs_notebooks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies:
1010
- dask-core >=2023.4.0
1111
- doc8
1212
- numba >=0.57
13-
- numpy >=1.24
13+
- numpy >=1.24,<2.4
1414
- properscoring
1515
- ipykernel
1616
- jupyterlab

ci/minimum-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ dependencies:
99
- coveralls
1010
- dask-core >=2023.4.0
1111
- matplotlib-base
12-
- numpy >=1.24
12+
- numba >=0.57
13+
- numpy >=1.24,<2.4
1314
- properscoring
1415
- pytest
1516
- pytest-cov

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66
name = "xskillscore"
77
dependencies = [
88
"dask[array] >=2023.4.0",
9-
"numpy >=1.24",
9+
"numpy >=1.24,<2.4",
1010
"properscoring",
1111
"scipy >=1.10",
1212
"statsmodels",
@@ -40,6 +40,7 @@ test = [
4040
"xskillscore[accel]",
4141
"cftime",
4242
"matplotlib",
43+
"packaging",
4344
"pre-commit",
4445
"pytest",
4546
"pytest-cov",

xskillscore/core/probabilistic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@
2828
except ImportError:
2929
from scipy.stats import rankdata
3030

31+
# Remove when `numpy` v1.x support is dropped
3132
try:
3233
from numpy import trapezoid
3334
except ImportError:
34-
from numpy import trapz as trapezoid # type: ignore[no-redef]
35+
from numpy import trapz as trapezoid # type: ignore[attr-defined,no-redef]
3536

3637
__all__ = [
3738
"brier_score",

xskillscore/tests/test_probabilistic.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import pytest
77
import xarray as xr
88
from dask import is_dask_collection
9+
from packaging.version import Version
910
from scipy.stats import norm
1011
from sklearn.calibration import calibration_curve
1112
from sklearn.metrics import roc_auc_score, roc_curve
@@ -64,10 +65,17 @@ def assert_chunk(actual, chunk_bool):
6465

6566

6667
def assert_keep_attrs(actual, o, keep_attrs):
67-
"""check that actual kept attributes only if keep_attrs==True."""
68+
"""
69+
check that actual kept attributes only if keep_attrs==True.
70+
71+
For newer xarray versions, attributes are preserved by default.
72+
"""
6873
if keep_attrs:
6974
assert actual.attrs == o.attrs
7075
else:
76+
if Version(xr.__version__) >= Version("2025.11.0"):
77+
if "source" in actual.attrs:
78+
del actual.attrs["source"]
7179
assert actual.attrs == {}
7280

7381

0 commit comments

Comments
 (0)