Skip to content

Commit d7edbd7

Browse files
authored
Bump dependencies incl pandas>=2 (#8968)
* Bump dependencies incl `pandas>=2` * fix whats-new * fix whats-new again * clean up test * bump h5py and hdf5 * Skip hdf5 * one more cleanup
1 parent 6d62719 commit d7edbd7

File tree

8 files changed

+40
-39
lines changed

8 files changed

+40
-39
lines changed

ci/requirements/bare-minimum.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ dependencies:
1212
- pytest-xdist
1313
- pytest-timeout
1414
- numpy=1.23
15-
- packaging=22.0
16-
- pandas=1.5
15+
- packaging=23.1
16+
- pandas=2.0

ci/requirements/min-all-deps.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ dependencies:
99
# doc/user-guide/installing.rst, doc/user-guide/plotting.rst and setup.py.
1010
- python=3.9
1111
- array-api-strict=1.0 # dependency for testing the array api compat
12-
- boto3=1.24
12+
- boto3=1.26
1313
- bottleneck=1.3
1414
- cartopy=0.21
1515
- cftime=1.6
1616
- coveralls
17-
- dask-core=2022.12
18-
- distributed=2022.12
17+
- dask-core=2023.4
18+
- distributed=2023.4
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
@@ -25,24 +25,24 @@ dependencies:
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
28-
- h5py=3.7
28+
- h5py=3.8
2929
- hdf5=1.12
3030
- hypothesis
3131
- iris=3.4
3232
- lxml=4.9 # Optional dep of pydap
33-
- matplotlib-base=3.6
33+
- matplotlib-base=3.7
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.56
3939
- numbagg=0.2.1
4040
- numpy=1.23
41-
- packaging=22.0
42-
- pandas=1.5
41+
- packaging=23.1
42+
- pandas=2.0
4343
- pint=0.22
4444
- pip
45-
- pydap=3.3
45+
- pydap=3.4
4646
- pytest
4747
- pytest-cov
4848
- pytest-env
@@ -51,7 +51,7 @@ dependencies:
5151
- rasterio=1.3
5252
- scipy=1.10
5353
- seaborn=0.12
54-
- sparse=0.13
54+
- sparse=0.14
5555
- toolz=0.12
56-
- typing_extensions=4.4
57-
- zarr=2.13
56+
- typing_extensions=4.5
57+
- zarr=2.14

doc/whats-new.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,23 @@ Breaking changes
3535
- The PyNIO backend has been deleted (:issue:`4491`, :pull:`7301`).
3636
By `Deepak Cherian <https://github.com/dcherian>`_.
3737

38+
- The minimum versions of some dependencies were changed, in particular our minimum supported pandas version is now Pandas 2.
39+
40+
===================== ========= =======
41+
Package Old New
42+
===================== ========= =======
43+
dask-core 2022.12 2023.4
44+
distributed 2022.12 2023.4
45+
h5py 3.7 3.8
46+
matplotlib-base 3.6 3.7
47+
packaging 22.0 23.1
48+
pandas 1.5 2.0
49+
pydap 3.3 3.4
50+
sparse 0.13 0.14
51+
typing_extensions 4.4 4.5
52+
zarr 2.13 2.14
53+
===================== ========= =======
54+
3855

3956
Bug fixes
4057
~~~~~~~~~

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ requires-python = ">=3.9"
2424

2525
dependencies = [
2626
"numpy>=1.23",
27-
"packaging>=22",
28-
"pandas>=1.5",
27+
"packaging>=23.1",
28+
"pandas>=2.0",
2929
]
3030

3131
[project.optional-dependencies]

xarray/tests/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,6 @@ def _importorskip(
141141
requires_numbagg_or_bottleneck = pytest.mark.skipif(
142142
not has_scipy_or_netCDF4, reason="requires scipy or netCDF4"
143143
)
144-
# _importorskip does not work for development versions
145-
has_pandas_version_two = Version(pd.__version__).major >= 2
146-
requires_pandas_version_two = pytest.mark.skipif(
147-
not has_pandas_version_two, reason="requires pandas 2.0.0"
148-
)
149144
has_numpy_array_api, requires_numpy_array_api = _importorskip("numpy", "1.26.0")
150145
has_h5netcdf_ros3, requires_h5netcdf_ros3 = _importorskip("h5netcdf", "1.3.0")
151146

xarray/tests/test_dataset.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
requires_cupy,
6262
requires_dask,
6363
requires_numexpr,
64-
requires_pandas_version_two,
6564
requires_pint,
6665
requires_scipy,
6766
requires_sparse,
@@ -3431,7 +3430,6 @@ def test_expand_dims_kwargs_python36plus(self) -> None:
34313430
)
34323431
assert_identical(other_way_expected, other_way)
34333432

3434-
@requires_pandas_version_two
34353433
def test_expand_dims_non_nanosecond_conversion(self) -> None:
34363434
# Regression test for https://github.com/pydata/xarray/issues/7493#issuecomment-1953091000
34373435
with pytest.warns(UserWarning, match="non-nanosecond precision"):

xarray/tests/test_groupby.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
create_test_data,
2323
has_cftime,
2424
has_flox,
25-
has_pandas_version_two,
2625
requires_dask,
2726
requires_flox,
2827
requires_scipy,
@@ -93,7 +92,7 @@ def test_groupby_sizes_property(dataset) -> None:
9392
assert dataset.groupby("x").sizes == dataset.isel(x=1).sizes
9493
with pytest.warns(UserWarning, match="The `squeeze` kwarg"):
9594
assert dataset.groupby("y").sizes == dataset.isel(y=1).sizes
96-
dataset = dataset.drop("cat")
95+
dataset = dataset.drop_vars("cat")
9796
stacked = dataset.stack({"xy": ("x", "y")})
9897
with pytest.warns(UserWarning, match="The `squeeze` kwarg"):
9998
assert stacked.groupby("xy").sizes == stacked.isel(xy=0).sizes
@@ -2172,7 +2171,6 @@ def test_upsample_interpolate_dask(self, chunked_time: bool) -> None:
21722171
# done here due to floating point arithmetic
21732172
assert_allclose(expected, actual, rtol=1e-16)
21742173

2175-
@pytest.mark.skipif(has_pandas_version_two, reason="requires pandas < 2.0.0")
21762174
def test_resample_base(self) -> None:
21772175
times = pd.date_range("2000-01-01T02:03:01", freq="6h", periods=10)
21782176
array = DataArray(np.arange(10), [("time", times)])
@@ -2204,11 +2202,10 @@ def test_resample_origin(self) -> None:
22042202
expected = DataArray(array.to_series().resample("24h", origin=origin).mean())
22052203
assert_identical(expected, actual)
22062204

2207-
@pytest.mark.skipif(has_pandas_version_two, reason="requires pandas < 2.0.0")
22082205
@pytest.mark.parametrize(
22092206
"loffset",
22102207
[
2211-
"-12H",
2208+
"-12h",
22122209
datetime.timedelta(hours=-12),
22132210
pd.Timedelta(hours=-12),
22142211
pd.DateOffset(hours=-12),

xarray/tests/test_variable.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@
3636
assert_equal,
3737
assert_identical,
3838
assert_no_warnings,
39-
has_pandas_version_two,
4039
raise_if_dask_computes,
4140
requires_bottleneck,
4241
requires_cupy,
4342
requires_dask,
44-
requires_pandas_version_two,
4543
requires_pint,
4644
requires_sparse,
4745
source_ndarray,
@@ -2645,7 +2643,6 @@ def test_datetime(self):
26452643
assert np.ndarray == type(actual)
26462644
assert np.dtype("datetime64[ns]") == actual.dtype
26472645

2648-
@requires_pandas_version_two
26492646
def test_tz_datetime(self) -> None:
26502647
tz = pytz.timezone("America/New_York")
26512648
times_ns = pd.date_range("2000", periods=1, tz=tz)
@@ -2938,7 +2935,7 @@ def test_from_pint_wrapping_dask(self, Var):
29382935

29392936

29402937
@pytest.mark.parametrize(
2941-
("values", "warns_under_pandas_version_two"),
2938+
("values", "warns"),
29422939
[
29432940
(np.datetime64("2000-01-01", "ns"), False),
29442941
(np.datetime64("2000-01-01", "s"), True),
@@ -2957,9 +2954,9 @@ def test_from_pint_wrapping_dask(self, Var):
29572954
],
29582955
ids=lambda x: f"{x}",
29592956
)
2960-
def test_datetime_conversion_warning(values, warns_under_pandas_version_two) -> None:
2957+
def test_datetime_conversion_warning(values, warns) -> None:
29612958
dims = ["time"] if isinstance(values, (np.ndarray, pd.Index, pd.Series)) else []
2962-
if warns_under_pandas_version_two and has_pandas_version_two:
2959+
if warns:
29632960
with pytest.warns(UserWarning, match="non-nanosecond precision datetime"):
29642961
var = Variable(dims, values)
29652962
else:
@@ -2979,7 +2976,6 @@ def test_datetime_conversion_warning(values, warns_under_pandas_version_two) ->
29792976
)
29802977

29812978

2982-
@requires_pandas_version_two
29832979
def test_pandas_two_only_datetime_conversion_warnings() -> None:
29842980
# Note these tests rely on pandas features that are only present in pandas
29852981
# 2.0.0 and above, and so for now cannot be parametrized.
@@ -3014,7 +3010,7 @@ def test_pandas_two_only_datetime_conversion_warnings() -> None:
30143010

30153011

30163012
@pytest.mark.parametrize(
3017-
("values", "warns_under_pandas_version_two"),
3013+
("values", "warns"),
30183014
[
30193015
(np.timedelta64(10, "ns"), False),
30203016
(np.timedelta64(10, "s"), True),
@@ -3026,9 +3022,9 @@ def test_pandas_two_only_datetime_conversion_warnings() -> None:
30263022
],
30273023
ids=lambda x: f"{x}",
30283024
)
3029-
def test_timedelta_conversion_warning(values, warns_under_pandas_version_two) -> None:
3025+
def test_timedelta_conversion_warning(values, warns) -> None:
30303026
dims = ["time"] if isinstance(values, (np.ndarray, pd.Index)) else []
3031-
if warns_under_pandas_version_two and has_pandas_version_two:
3027+
if warns:
30323028
with pytest.warns(UserWarning, match="non-nanosecond precision timedelta"):
30333029
var = Variable(dims, values)
30343030
else:
@@ -3039,7 +3035,6 @@ def test_timedelta_conversion_warning(values, warns_under_pandas_version_two) ->
30393035
assert var.dtype == np.dtype("timedelta64[ns]")
30403036

30413037

3042-
@requires_pandas_version_two
30433038
def test_pandas_two_only_timedelta_conversion_warning() -> None:
30443039
# Note this test relies on a pandas feature that is only present in pandas
30453040
# 2.0.0 and above, and so for now cannot be parametrized.
@@ -3050,7 +3045,6 @@ def test_pandas_two_only_timedelta_conversion_warning() -> None:
30503045
assert var.dtype == np.dtype("timedelta64[ns]")
30513046

30523047

3053-
@requires_pandas_version_two
30543048
@pytest.mark.parametrize(
30553049
("index", "dtype"),
30563050
[

0 commit comments

Comments
 (0)