diff --git a/ci/requirements/bare-minimum.yml b/ci/requirements/bare-minimum.yml index 56af319f0bb..105e90ce109 100644 --- a/ci/requirements/bare-minimum.yml +++ b/ci/requirements/bare-minimum.yml @@ -12,5 +12,5 @@ dependencies: - pytest-xdist - pytest-timeout - numpy=1.23 - - packaging=22.0 - - pandas=1.5 + - packaging=23.1 + - pandas=2.0 diff --git a/ci/requirements/min-all-deps.yml b/ci/requirements/min-all-deps.yml index d2965fb3fc5..64f4327bbcb 100644 --- a/ci/requirements/min-all-deps.yml +++ b/ci/requirements/min-all-deps.yml @@ -9,13 +9,13 @@ dependencies: # doc/user-guide/installing.rst, doc/user-guide/plotting.rst and setup.py. - python=3.9 - array-api-strict=1.0 # dependency for testing the array api compat - - boto3=1.24 + - boto3=1.26 - bottleneck=1.3 - cartopy=0.21 - cftime=1.6 - coveralls - - dask-core=2022.12 - - distributed=2022.12 + - dask-core=2023.4 + - distributed=2023.4 # Flox > 0.8 has a bug with numbagg versions # It will require numbagg > 0.6 # so we should just skip that series eventually @@ -25,12 +25,12 @@ dependencies: # h5py and hdf5 tend to cause conflicts # for e.g. hdf5 1.12 conflicts with h5py=3.1 # prioritize bumping other packages instead - - h5py=3.7 + - h5py=3.8 - hdf5=1.12 - hypothesis - iris=3.4 - lxml=4.9 # Optional dep of pydap - - matplotlib-base=3.6 + - matplotlib-base=3.7 - nc-time-axis=1.4 # netcdf follows a 1.major.minor[.patch] convention # (see https://github.com/Unidata/netcdf4-python/issues/1090) @@ -38,11 +38,11 @@ dependencies: - numba=0.56 - numbagg=0.2.1 - numpy=1.23 - - packaging=22.0 - - pandas=1.5 + - packaging=23.1 + - pandas=2.0 - pint=0.22 - pip - - pydap=3.3 + - pydap=3.4 - pytest - pytest-cov - pytest-env @@ -51,7 +51,7 @@ dependencies: - rasterio=1.3 - scipy=1.10 - seaborn=0.12 - - sparse=0.13 + - sparse=0.14 - toolz=0.12 - - typing_extensions=4.4 - - zarr=2.13 + - typing_extensions=4.5 + - zarr=2.14 diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 8b05b729a31..f26e311ae2b 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -35,6 +35,23 @@ Breaking changes - The PyNIO backend has been deleted (:issue:`4491`, :pull:`7301`). By `Deepak Cherian `_. +- The minimum versions of some dependencies were changed, in particular our minimum supported pandas version is now Pandas 2. + + ===================== ========= ======= + Package Old New + ===================== ========= ======= + dask-core 2022.12 2023.4 + distributed 2022.12 2023.4 + h5py 3.7 3.8 + matplotlib-base 3.6 3.7 + packaging 22.0 23.1 + pandas 1.5 2.0 + pydap 3.3 3.4 + sparse 0.13 0.14 + typing_extensions 4.4 4.5 + zarr 2.13 2.14 + ===================== ========= ======= + Bug fixes ~~~~~~~~~ diff --git a/pyproject.toml b/pyproject.toml index 0fc26e5b82e..dc1b9d65de6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,8 +24,8 @@ requires-python = ">=3.9" dependencies = [ "numpy>=1.23", - "packaging>=22", - "pandas>=1.5", + "packaging>=23.1", + "pandas>=2.0", ] [project.optional-dependencies] diff --git a/xarray/tests/__init__.py b/xarray/tests/__init__.py index 26232471aaf..7ea02eafd76 100644 --- a/xarray/tests/__init__.py +++ b/xarray/tests/__init__.py @@ -141,11 +141,6 @@ def _importorskip( requires_numbagg_or_bottleneck = pytest.mark.skipif( not has_scipy_or_netCDF4, reason="requires scipy or netCDF4" ) -# _importorskip does not work for development versions -has_pandas_version_two = Version(pd.__version__).major >= 2 -requires_pandas_version_two = pytest.mark.skipif( - not has_pandas_version_two, reason="requires pandas 2.0.0" -) has_numpy_array_api, requires_numpy_array_api = _importorskip("numpy", "1.26.0") has_h5netcdf_ros3, requires_h5netcdf_ros3 = _importorskip("h5netcdf", "1.3.0") diff --git a/xarray/tests/test_dataset.py b/xarray/tests/test_dataset.py index a948fafc815..e853031a1da 100644 --- a/xarray/tests/test_dataset.py +++ b/xarray/tests/test_dataset.py @@ -61,7 +61,6 @@ requires_cupy, requires_dask, requires_numexpr, - requires_pandas_version_two, requires_pint, requires_scipy, requires_sparse, @@ -3431,7 +3430,6 @@ def test_expand_dims_kwargs_python36plus(self) -> None: ) assert_identical(other_way_expected, other_way) - @requires_pandas_version_two def test_expand_dims_non_nanosecond_conversion(self) -> None: # Regression test for https://github.com/pydata/xarray/issues/7493#issuecomment-1953091000 with pytest.warns(UserWarning, match="non-nanosecond precision"): diff --git a/xarray/tests/test_groupby.py b/xarray/tests/test_groupby.py index afe4d669628..e9e4eb1364c 100644 --- a/xarray/tests/test_groupby.py +++ b/xarray/tests/test_groupby.py @@ -22,7 +22,6 @@ create_test_data, has_cftime, has_flox, - has_pandas_version_two, requires_dask, requires_flox, requires_scipy, @@ -93,7 +92,7 @@ def test_groupby_sizes_property(dataset) -> None: assert dataset.groupby("x").sizes == dataset.isel(x=1).sizes with pytest.warns(UserWarning, match="The `squeeze` kwarg"): assert dataset.groupby("y").sizes == dataset.isel(y=1).sizes - dataset = dataset.drop("cat") + dataset = dataset.drop_vars("cat") stacked = dataset.stack({"xy": ("x", "y")}) with pytest.warns(UserWarning, match="The `squeeze` kwarg"): assert stacked.groupby("xy").sizes == stacked.isel(xy=0).sizes @@ -2172,7 +2171,6 @@ def test_upsample_interpolate_dask(self, chunked_time: bool) -> None: # done here due to floating point arithmetic assert_allclose(expected, actual, rtol=1e-16) - @pytest.mark.skipif(has_pandas_version_two, reason="requires pandas < 2.0.0") def test_resample_base(self) -> None: times = pd.date_range("2000-01-01T02:03:01", freq="6h", periods=10) array = DataArray(np.arange(10), [("time", times)]) @@ -2204,11 +2202,10 @@ def test_resample_origin(self) -> None: expected = DataArray(array.to_series().resample("24h", origin=origin).mean()) assert_identical(expected, actual) - @pytest.mark.skipif(has_pandas_version_two, reason="requires pandas < 2.0.0") @pytest.mark.parametrize( "loffset", [ - "-12H", + "-12h", datetime.timedelta(hours=-12), pd.Timedelta(hours=-12), pd.DateOffset(hours=-12), diff --git a/xarray/tests/test_variable.py b/xarray/tests/test_variable.py index 8a9345e74d4..3167de2e2f0 100644 --- a/xarray/tests/test_variable.py +++ b/xarray/tests/test_variable.py @@ -36,12 +36,10 @@ assert_equal, assert_identical, assert_no_warnings, - has_pandas_version_two, raise_if_dask_computes, requires_bottleneck, requires_cupy, requires_dask, - requires_pandas_version_two, requires_pint, requires_sparse, source_ndarray, @@ -2645,7 +2643,6 @@ def test_datetime(self): assert np.ndarray == type(actual) assert np.dtype("datetime64[ns]") == actual.dtype - @requires_pandas_version_two def test_tz_datetime(self) -> None: tz = pytz.timezone("America/New_York") times_ns = pd.date_range("2000", periods=1, tz=tz) @@ -2938,7 +2935,7 @@ def test_from_pint_wrapping_dask(self, Var): @pytest.mark.parametrize( - ("values", "warns_under_pandas_version_two"), + ("values", "warns"), [ (np.datetime64("2000-01-01", "ns"), False), (np.datetime64("2000-01-01", "s"), True), @@ -2957,9 +2954,9 @@ def test_from_pint_wrapping_dask(self, Var): ], ids=lambda x: f"{x}", ) -def test_datetime_conversion_warning(values, warns_under_pandas_version_two) -> None: +def test_datetime_conversion_warning(values, warns) -> None: dims = ["time"] if isinstance(values, (np.ndarray, pd.Index, pd.Series)) else [] - if warns_under_pandas_version_two and has_pandas_version_two: + if warns: with pytest.warns(UserWarning, match="non-nanosecond precision datetime"): var = Variable(dims, values) else: @@ -2979,7 +2976,6 @@ def test_datetime_conversion_warning(values, warns_under_pandas_version_two) -> ) -@requires_pandas_version_two def test_pandas_two_only_datetime_conversion_warnings() -> None: # Note these tests rely on pandas features that are only present in pandas # 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: @pytest.mark.parametrize( - ("values", "warns_under_pandas_version_two"), + ("values", "warns"), [ (np.timedelta64(10, "ns"), False), (np.timedelta64(10, "s"), True), @@ -3026,9 +3022,9 @@ def test_pandas_two_only_datetime_conversion_warnings() -> None: ], ids=lambda x: f"{x}", ) -def test_timedelta_conversion_warning(values, warns_under_pandas_version_two) -> None: +def test_timedelta_conversion_warning(values, warns) -> None: dims = ["time"] if isinstance(values, (np.ndarray, pd.Index)) else [] - if warns_under_pandas_version_two and has_pandas_version_two: + if warns: with pytest.warns(UserWarning, match="non-nanosecond precision timedelta"): var = Variable(dims, values) else: @@ -3039,7 +3035,6 @@ def test_timedelta_conversion_warning(values, warns_under_pandas_version_two) -> assert var.dtype == np.dtype("timedelta64[ns]") -@requires_pandas_version_two def test_pandas_two_only_timedelta_conversion_warning() -> None: # Note this test relies on a pandas feature that is only present in pandas # 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: assert var.dtype == np.dtype("timedelta64[ns]") -@requires_pandas_version_two @pytest.mark.parametrize( ("index", "dtype"), [