From 1820aa6c4597c47de79747b1f0fb386be0d799c7 Mon Sep 17 00:00:00 2001 From: veenstrajelmer <60435591+veenstrajelmer@users.noreply.github.com> Date: Sat, 14 Oct 2023 00:48:25 +0200 Subject: [PATCH] updated requirements for py39 (#588) * tightened xarray requirements for py39 to avoid resampling error with pandas<2.0.0 * improved ordering and explanation in comments --- setup.cfg | 7 +++++-- tests/test_external_packages.py | 8 +++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/setup.cfg b/setup.cfg index a7f03e70e..f29a5a011 100644 --- a/setup.cfg +++ b/setup.cfg @@ -34,8 +34,8 @@ install_requires = #contour colorbar on uniform values fails with matplotlib<3.7.0, several other features with matplotlib<3.6.0 matplotlib>=3.7.0 #pandas<2.0.0 in case of py38 to avoid conflict with xarray<2023.3.0: https://github.com/Deltares/xugrid/issues/78#issuecomment-1597723955 (xarray 2023.1.0 is the latest py38 release, and py38 is still supported by dfm_tools) + #pandas>=1.4 is required by xarray>=2023.3.0 pandas<2.0.0;python_version<='3.8' - #pandas>=1.4 is required by xarray>=2023.3.0. TODO: if pandas>=2.0.0 is installed, xarray>=2023.3.0 is required (not supported by py38) pandas>=1.4.0 #shapely<2.0.0 give "AttributeError: module 'shapely' has no attribute 'GeometryType'" shapely>=2.0.0 @@ -45,9 +45,12 @@ install_requires = fiona>=1.9 #contextily<1.0.0 is from April 2020 contextily>=1.0.0 + #xarray<2023.4.0 conflicts with pandas<2.0.0 for resampling, only available for py39 #xarray<2022.6.0 did not find certain variable in dataset in test_data_map testcase. TODO: lower xarray/dask to 2022.6.0 when xugrid>0.6.5 is available + xarray>=2023.4.0;python_version>='3.9' xarray>=2022.11.0 - #aligned with xarray, no particular reason + #dask is aligned with xarray, no particular reason + dask>=2023.4.0;python_version>='3.9' dask>=2022.11.0 #netcdf4<1.5.4 pip install fails in py39 netcdf4>=1.5.4 diff --git a/tests/test_external_packages.py b/tests/test_external_packages.py index 9a7b472bb..bef80edd8 100644 --- a/tests/test_external_packages.py +++ b/tests/test_external_packages.py @@ -107,9 +107,11 @@ def test_xugrid_opendataset_ugridplot_contour_with_colorbar(): def test_xarray_pandas_resample(): """ this one fails with xarray<2023.3.0 (required for test_opendataset_ugridplot()) and pandas>1.5.3: https://github.com/Deltares/xugrid/issues/78#issuecomment-1597723955 - pandas 1.5.3 works with xarray<2023.3.0 - pandas 2.0.* fails with xarray<2023.3.0 - pandas 2.0.* works with xarray==2023.5.0 + pandas<1.5.3 works with xarray (any version) + pandas>=2.0.0 fails with xarray<2023.3.0 + pandas>=2.0.0 cannot be installed with xarray==2023.3.0 (latter requires pandas<2 and >=1.4) + pandas>=2.0.0 works with xarray>=2023.4.0 + therefore, xarray>=2023.4.0 works pandas (any version) """ ds = xr.tutorial.load_dataset("air_temperature") ds.resample(time='D')