Skip to content

Commit

Permalink
updated requirements for py39 (#588)
Browse files Browse the repository at this point in the history
* tightened xarray requirements for py39 to avoid resampling error with pandas<2.0.0

* improved ordering and explanation in comments
  • Loading branch information
veenstrajelmer authored Oct 13, 2023
1 parent e0b5639 commit 1820aa6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 5 additions & 3 deletions tests/test_external_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 1820aa6

Please sign in to comment.