Skip to content
forked from pydata/xarray

Commit 700191b

Browse files
dcheriankeewis
andauthored
Bump minimum versions (pydata#9796)
* Bump minimum versions * tweak * Update doc/whats-new.rst Co-authored-by: Justus Magin <[email protected]> --------- Co-authored-by: Justus Magin <[email protected]>
1 parent 5d70f4d commit 700191b

File tree

10 files changed

+33
-73
lines changed

10 files changed

+33
-73
lines changed

ci/requirements/doc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dependencies:
2323
- netcdf4>=1.5
2424
- numba
2525
- numpy>=2
26-
- packaging>=21.3
26+
- packaging>=23.2
2727
- pandas>=1.4,!=2.1.0
2828
- pooch
2929
- pip

ci/requirements/min-all-deps.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ dependencies:
99
# doc/user-guide/installing.rst, doc/user-guide/plotting.rst and setup.py.
1010
- python=3.10
1111
- array-api-strict=1.0 # dependency for testing the array api compat
12-
- boto3=1.28
12+
- boto3=1.29
1313
- bottleneck=1.3
1414
- cartopy=0.22
1515
- cftime=1.6
1616
- coveralls
17-
- dask-core=2023.9
18-
- distributed=2023.9
17+
- dask-core=2023.11
18+
- distributed=2023.11
1919
# Flox > 0.8 has a bug with numbagg versions
2020
# It will require numbagg > 0.6
2121
# so we should just skip that series eventually
2222
# or keep flox pinned for longer than necessary
2323
- flox=0.7
24-
- h5netcdf=1.2
24+
- h5netcdf=1.3
2525
# h5py and hdf5 tend to cause conflicts
2626
# for e.g. hdf5 1.12 conflicts with h5py=3.1
2727
# prioritize bumping other packages instead
@@ -30,15 +30,15 @@ dependencies:
3030
- hypothesis
3131
- iris=3.7
3232
- lxml=4.9 # Optional dep of pydap
33-
- matplotlib-base=3.7
33+
- matplotlib-base=3.8
3434
- nc-time-axis=1.4
3535
# netcdf follows a 1.major.minor[.patch] convention
3636
# (see https://github.com/Unidata/netcdf4-python/issues/1090)
3737
- netcdf4=1.6.0
3838
- numba=0.57
39-
- numbagg=0.2.1
39+
- numbagg=0.6
4040
- numpy=1.24
41-
- packaging=23.1
41+
- packaging=23.2
4242
- pandas=2.1
4343
- pint=0.22
4444
- pip
@@ -50,8 +50,8 @@ dependencies:
5050
- pytest-timeout
5151
- rasterio=1.3
5252
- scipy=1.11
53-
- seaborn=0.12
53+
- seaborn=0.13
5454
- sparse=0.14
5555
- toolz=0.12
56-
- typing_extensions=4.7
56+
- typing_extensions=4.8
5757
- zarr=2.16

doc/whats-new.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ What's New
1919
v.2024.10.1 (unreleased)
2020
------------------------
2121

22+
23+
Breaking Changes
24+
~~~~~~~~~~~~~~~~
25+
- The minimum versions of some dependencies were changed
26+
27+
===================== ========= =======
28+
Package Old New
29+
===================== ========= =======
30+
boto3 1.28 1.29
31+
dask-core 2023.9 2023.11
32+
distributed 2023.9 2023.11
33+
h5netcdf 1.2 1.3
34+
numbagg 0.2.1 0.6
35+
typing_extensions 4.7 4.8
36+
===================== ========= =======
37+
2238
New Features
2339
~~~~~~~~~~~~
2440
- Added :py:meth:`DataTree.persist` method (:issue:`9675`, :pull:`9682`).

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ requires-python = ">=3.10"
2323

2424
dependencies = [
2525
"numpy>=1.24",
26-
"packaging>=23.1",
26+
"packaging>=23.2",
2727
"pandas>=2.1",
2828
]
2929

xarray/core/duck_array_ops.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@
3030
transpose,
3131
unravel_index,
3232
)
33-
from packaging.version import Version
3433
from pandas.api.types import is_extension_array_dtype
3534

3635
from xarray.core import dask_array_compat, dask_array_ops, dtypes, nputils
3736
from xarray.core.options import OPTIONS
3837
from xarray.core.utils import is_duck_array, is_duck_dask_array, module_available
39-
from xarray.namedarray import pycompat
4038
from xarray.namedarray.parallelcompat import get_chunked_array_type
4139
from xarray.namedarray.pycompat import array_type, is_chunked_array
4240

@@ -770,13 +768,7 @@ def _push(array, n: int | None = None, axis: int = -1):
770768
if OPTIONS["use_numbagg"] and module_available("numbagg"):
771769
import numbagg
772770

773-
if pycompat.mod_version("numbagg") < Version("0.6.2"):
774-
warnings.warn(
775-
f"numbagg >= 0.6.2 is required for bfill & ffill; {pycompat.mod_version('numbagg')} is installed. We'll attempt with bottleneck instead.",
776-
stacklevel=2,
777-
)
778-
else:
779-
return numbagg.ffill(array, limit=n, axis=axis)
771+
return numbagg.ffill(array, limit=n, axis=axis)
780772

781773
# work around for bottleneck 178
782774
limit = n if n is not None else array.shape[axis]

xarray/core/nputils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ def f(values, axis=None, **kwargs):
181181

182182
if (
183183
module_available("numbagg")
184-
and pycompat.mod_version("numbagg") >= Version("0.5.0")
185184
and OPTIONS["use_numbagg"]
186185
and isinstance(values, np.ndarray)
187186
# numbagg<0.7.0 uses ddof=1 only, but numpy uses ddof=0 by default

xarray/core/rolling.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from typing import TYPE_CHECKING, Any, Generic, TypeVar
99

1010
import numpy as np
11-
from packaging.version import Version
1211

1312
from xarray.core import dask_array_ops, dtypes, duck_array_ops, utils
1413
from xarray.core.arithmetic import CoarsenArithmetic
@@ -19,7 +18,6 @@
1918
is_duck_dask_array,
2019
module_available,
2120
)
22-
from xarray.namedarray import pycompat
2321
from xarray.util.deprecation_helpers import _deprecate_positional_args
2422

2523
try:
@@ -713,7 +711,6 @@ def _array_reduce(
713711
if (
714712
OPTIONS["use_numbagg"]
715713
and module_available("numbagg")
716-
and pycompat.mod_version("numbagg") >= Version("0.6.3")
717714
and numbagg_move_func is not None
718715
# TODO: we could at least allow this for the equivalent of `apply_ufunc`'s
719716
# "parallelized". `rolling_exp` does this, as an example (but rolling_exp is

xarray/core/rolling_exp.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44
from typing import Any, Generic
55

66
import numpy as np
7-
from packaging.version import Version
87

98
from xarray.core.computation import apply_ufunc
109
from xarray.core.options import _get_keep_attrs
1110
from xarray.core.pdcompat import count_not_none
1211
from xarray.core.types import T_DataWithCoords
1312
from xarray.core.utils import module_available
14-
from xarray.namedarray import pycompat
1513

1614

1715
def _get_alpha(
@@ -81,14 +79,6 @@ def __init__(
8179
raise ImportError(
8280
"numbagg >= 0.2.1 is required for rolling_exp but currently numbagg is not installed"
8381
)
84-
elif pycompat.mod_version("numbagg") < Version("0.2.1"):
85-
raise ImportError(
86-
f"numbagg >= 0.2.1 is required for rolling_exp but currently version {pycompat.mod_version('numbagg')} is installed"
87-
)
88-
elif pycompat.mod_version("numbagg") < Version("0.3.1") and min_weight > 0:
89-
raise ImportError(
90-
f"numbagg >= 0.3.1 is required for `min_weight > 0` within `.rolling_exp` but currently version {pycompat.mod_version('numbagg')} is installed"
91-
)
9282

9383
self.obj: T_DataWithCoords = obj
9484
dim, window = next(iter(windows.items()))
@@ -192,10 +182,6 @@ def std(self) -> T_DataWithCoords:
192182
Dimensions without coordinates: x
193183
"""
194184

195-
if pycompat.mod_version("numbagg") < Version("0.4.0"):
196-
raise ImportError(
197-
f"numbagg >= 0.4.0 is required for rolling_exp().std(), currently {pycompat.mod_version('numbagg')} is installed"
198-
)
199185
import numbagg
200186

201187
dim_order = self.obj.dims
@@ -225,10 +211,6 @@ def var(self) -> T_DataWithCoords:
225211
array([ nan, 0. , 0.46153846, 0.18461538, 0.06446281])
226212
Dimensions without coordinates: x
227213
"""
228-
if pycompat.mod_version("numbagg") < Version("0.4.0"):
229-
raise ImportError(
230-
f"numbagg >= 0.4.0 is required for rolling_exp().var(), currently {pycompat.mod_version('numbagg')} is installed"
231-
)
232214
dim_order = self.obj.dims
233215
import numbagg
234216

@@ -258,10 +240,6 @@ def cov(self, other: T_DataWithCoords) -> T_DataWithCoords:
258240
Dimensions without coordinates: x
259241
"""
260242

261-
if pycompat.mod_version("numbagg") < Version("0.4.0"):
262-
raise ImportError(
263-
f"numbagg >= 0.4.0 is required for rolling_exp().cov(), currently {pycompat.mod_version('numbagg')} is installed"
264-
)
265243
dim_order = self.obj.dims
266244
import numbagg
267245

@@ -292,10 +270,6 @@ def corr(self, other: T_DataWithCoords) -> T_DataWithCoords:
292270
Dimensions without coordinates: x
293271
"""
294272

295-
if pycompat.mod_version("numbagg") < Version("0.4.0"):
296-
raise ImportError(
297-
f"numbagg >= 0.4.0 is required for rolling_exp().corr(), currently {pycompat.mod_version('numbagg')} is installed"
298-
)
299273
dim_order = self.obj.dims
300274
import numbagg
301275

xarray/namedarray/daskmanager.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from typing import TYPE_CHECKING, Any
55

66
import numpy as np
7-
from packaging.version import Version
87

98
from xarray.core.indexing import ImplicitToExplicitIndexingAdapter
109
from xarray.namedarray.parallelcompat import ChunkManagerEntrypoint, T_ChunkedArray
@@ -182,14 +181,8 @@ def map_blocks(
182181
new_axis: int | Sequence[int] | None = None,
183182
**kwargs: Any,
184183
) -> Any:
185-
import dask
186184
from dask.array import map_blocks
187185

188-
if drop_axis is None and Version(dask.__version__) < Version("2022.9.1"):
189-
# See https://github.com/pydata/xarray/pull/7019#discussion_r1196729489
190-
# TODO remove once dask minimum version >= 2022.9.1
191-
drop_axis = []
192-
193186
# pass through name, meta, token as kwargs
194187
return map_blocks(
195188
func,

xarray/tests/__init__.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def _importorskip(
122122
has_zarr_v3, requires_zarr_v3 = _importorskip("zarr", "2.99")
123123
has_fsspec, requires_fsspec = _importorskip("fsspec")
124124
has_iris, requires_iris = _importorskip("iris")
125-
has_numbagg, requires_numbagg = _importorskip("numbagg", "0.4.0")
125+
has_numbagg, requires_numbagg = _importorskip("numbagg")
126126
has_pyarrow, requires_pyarrow = _importorskip("pyarrow")
127127
with warnings.catch_warnings():
128128
warnings.filterwarnings(
@@ -157,34 +157,23 @@ def _importorskip(
157157
has_array_api_strict, requires_array_api_strict = _importorskip("array_api_strict")
158158

159159

160-
def _importorskip_h5netcdf_ros3():
161-
try:
162-
import h5netcdf
163-
164-
has_h5netcdf = True
165-
except ImportError:
166-
has_h5netcdf = False
167-
160+
def _importorskip_h5netcdf_ros3(has_h5netcdf: bool):
168161
if not has_h5netcdf:
169162
return has_h5netcdf, pytest.mark.skipif(
170163
not has_h5netcdf, reason="requires h5netcdf"
171164
)
172165

173-
h5netcdf_with_ros3 = Version(h5netcdf.__version__) >= Version("1.3.0")
174-
175166
import h5py
176167

177168
h5py_with_ros3 = h5py.get_config().ros3
178169

179-
has_h5netcdf_ros3 = h5netcdf_with_ros3 and h5py_with_ros3
180-
181-
return has_h5netcdf_ros3, pytest.mark.skipif(
182-
not has_h5netcdf_ros3,
170+
return h5py_with_ros3, pytest.mark.skipif(
171+
not h5py_with_ros3,
183172
reason="requires h5netcdf>=1.3.0 and h5py with ros3 support",
184173
)
185174

186175

187-
has_h5netcdf_ros3, requires_h5netcdf_ros3 = _importorskip_h5netcdf_ros3()
176+
has_h5netcdf_ros3, requires_h5netcdf_ros3 = _importorskip_h5netcdf_ros3(has_h5netcdf)
188177
has_netCDF4_1_6_2_or_above, requires_netCDF4_1_6_2_or_above = _importorskip(
189178
"netCDF4", "1.6.2"
190179
)

0 commit comments

Comments
 (0)