Skip to content

Commit 971b1f5

Browse files
TomNicholaskeewisdcherian
authored
Update minimum dependencies for 0.20 (#5917)
* conda ci requirements * update setup.cfg for 0.20 * update dependency list in whatsnew * try removing setuptools * Fix * update * Update ci/requirements/py37-min-all-deps.yml * fix test * add notes * fix pint * fix accessor * One more fix * one last fix? Co-authored-by: keewis <keewis@users.noreply.github.com> Co-authored-by: dcherian <deepak@cherian.net> Co-authored-by: Deepak Cherian <dcherian@users.noreply.github.com>
1 parent e3b689d commit 971b1f5

18 files changed

+59
-129
lines changed

ci/requirements/py37-bare-minimum.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ dependencies:
1010
- pytest-cov
1111
- pytest-env
1212
- pytest-xdist
13-
- numpy=1.17
14-
- pandas=1.0
13+
- numpy=1.18
14+
- pandas=1.1
1515
- typing_extensions=3.7

ci/requirements/py37-min-all-deps.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,31 @@ dependencies:
1010
- python=3.7
1111
- boto3=1.13
1212
- bottleneck=1.3
13+
# cartopy 0.18 conflicts with pynio
1314
- cartopy=0.17
1415
- cdms2=3.1
1516
- cfgrib=0.9
16-
- cftime=1.1
17+
- cftime=1.2
1718
- coveralls
18-
- dask=2.24
19-
- distributed=2.24
19+
- dask=2.30
20+
- distributed=2.30
2021
- h5netcdf=0.8
2122
- h5py=2.10
23+
# hdf5 1.12 conflicts with h5py=2.10
2224
- hdf5=1.10
2325
- hypothesis
2426
- iris=2.4
25-
- lxml=4.5 # Optional dep of pydap
26-
- matplotlib-base=3.2
27+
- lxml=4.6 # Optional dep of pydap
28+
- matplotlib-base=3.3
2729
- nc-time-axis=1.2
2830
# netcdf follows a 1.major.minor[.patch] convention
2931
# (see https://github.com/Unidata/netcdf4-python/issues/1090)
3032
# bumping the netCDF4 version is currently blocked by #4491
3133
- netcdf4=1.5.3
32-
- numba=0.49
33-
- numpy=1.17
34-
- pandas=1.0
35-
- pint=0.15
34+
- numba=0.51
35+
- numpy=1.18
36+
- pandas=1.1
37+
- pint=0.16
3638
- pip
3739
- pseudonetcdf=3.1
3840
- pydap=3.2
@@ -42,13 +44,11 @@ dependencies:
4244
- pytest-env
4345
- pytest-xdist
4446
- rasterio=1.1
45-
- scipy=1.4
46-
- seaborn=0.10
47-
# don't need to pin setuptools, now that we don't depend on it
48-
- setuptools
49-
- sparse=0.8
50-
- toolz=0.10
47+
- scipy=1.5
48+
- seaborn=0.11
49+
- sparse=0.11
50+
- toolz=0.11
5151
- typing_extensions=3.7
52-
- zarr=2.4
52+
- zarr=2.5
5353
- pip:
5454
- numbagg==0.1

doc/whats-new.rst

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,24 @@ Breaking changes
4949
~~~~~~~~~~~~~~~~
5050
- The minimum versions of some dependencies were changed:
5151

52-
============ ====== ====
53-
Package Old New
54-
============ ====== ====
55-
dask 2.15 2.24
56-
distributed 2.15 2.24
57-
============ ====== ====
52+
=============== ====== ====
53+
Package Old New
54+
=============== ====== ====
55+
cftime 1.1 1.2
56+
dask 2.15 2.30
57+
distributed 2.15 2.30
58+
lxml 4.5 4.6
59+
matplotlib-base 3.2 3.3
60+
numba 0.49 0.51
61+
numpy 1.17 1.18
62+
pandas 1.0 1.1
63+
pint 0.15 0.16
64+
scipy 1.4 1.5
65+
seaborn 0.10 0.11
66+
sparse 0.8 0.11
67+
toolz 0.10 0.11
68+
zarr 2.4 2.5
69+
=============== ====== ====
5870

5971
- The ``__repr__`` of a :py:class:`xarray.Dataset`'s ``coords`` and ``data_vars``
6072
ignore ``xarray.set_option(display_max_rows=...)`` and show the full output

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ zip_safe = False # https://mypy.readthedocs.io/en/latest/installed_packages.htm
7676
include_package_data = True
7777
python_requires = >=3.7
7878
install_requires =
79-
numpy >= 1.17
80-
pandas >= 1.0
79+
numpy >= 1.18
80+
pandas >= 1.1
8181
importlib-metadata; python_version < '3.8'
8282
typing_extensions >= 3.7; python_version < '3.8'
8383

xarray/backends/zarr.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
import warnings
3-
from distutils.version import LooseVersion
43

54
import numpy as np
65

@@ -353,10 +352,7 @@ def open_group(
353352
synchronizer=synchronizer,
354353
path=group,
355354
)
356-
if LooseVersion(zarr.__version__) >= "2.5.0":
357-
open_kwargs["storage_options"] = storage_options
358-
elif storage_options:
359-
raise ValueError("Storage options only compatible with zarr>=2.5.0")
355+
open_kwargs["storage_options"] = storage_options
360356

361357
if chunk_store:
362358
open_kwargs["chunk_store"] = chunk_store

xarray/coding/cftime_offsets.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242

4343
import re
4444
from datetime import timedelta
45-
from distutils.version import LooseVersion
4645
from functools import partial
4746
from typing import ClassVar, Optional
4847

@@ -243,14 +242,7 @@ def _shift_month(date, months, day_option="start"):
243242
day = _days_in_month(reference)
244243
else:
245244
raise ValueError(day_option)
246-
if LooseVersion(cftime.__version__) < LooseVersion("1.0.4"):
247-
# dayofwk=-1 is required to update the dayofwk and dayofyr attributes of
248-
# the returned date object in versions of cftime between 1.0.2 and
249-
# 1.0.3.4. It can be removed for versions of cftime greater than
250-
# 1.0.3.4.
251-
return date.replace(year=year, month=month, day=day, dayofwk=-1)
252-
else:
253-
return date.replace(year=year, month=month, day=day)
245+
return date.replace(year=year, month=month, day=day)
254246

255247

256248
def roll_qtrday(other, n, month, day_option, modby=3):

xarray/coding/cftimeindex.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,6 @@ def _parse_iso8601_with_reso(date_type, timestr):
134134
# TODO: Consider adding support for sub-second resolution?
135135
replace[attr] = int(value)
136136
resolution = attr
137-
if LooseVersion(cftime.__version__) < LooseVersion("1.0.4"):
138-
# dayofwk=-1 is required to update the dayofwk and dayofyr attributes of
139-
# the returned date object in versions of cftime between 1.0.2 and
140-
# 1.0.3.4. It can be removed for versions of cftime greater than
141-
# 1.0.3.4.
142-
replace["dayofwk"] = -1
143137
return default.replace(**replace), resolution
144138

145139

xarray/coding/times.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import re
22
import warnings
33
from datetime import datetime, timedelta
4-
from distutils.version import LooseVersion
54
from functools import partial
65

76
import numpy as np
@@ -269,19 +268,13 @@ def decode_cf_datetime(num_dates, units, calendar=None, use_cftime=None):
269268

270269

271270
def to_timedelta_unboxed(value, **kwargs):
272-
if LooseVersion(pd.__version__) < "0.25.0":
273-
result = pd.to_timedelta(value, **kwargs, box=False)
274-
else:
275-
result = pd.to_timedelta(value, **kwargs).to_numpy()
271+
result = pd.to_timedelta(value, **kwargs).to_numpy()
276272
assert result.dtype == "timedelta64[ns]"
277273
return result
278274

279275

280276
def to_datetime_unboxed(value, **kwargs):
281-
if LooseVersion(pd.__version__) < "0.25.0":
282-
result = pd.to_datetime(value, **kwargs, box=False)
283-
else:
284-
result = pd.to_datetime(value, **kwargs).to_numpy()
277+
result = pd.to_datetime(value, **kwargs).to_numpy()
285278
assert result.dtype == "datetime64[ns]"
286279
return result
287280

xarray/core/accessor_dt.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import warnings
2-
from distutils.version import LooseVersion
32

43
import numpy as np
54
import pandas as pd
@@ -336,9 +335,6 @@ def isocalendar(self):
336335
if not is_np_datetime_like(self._obj.data.dtype):
337336
raise AttributeError("'CFTimeIndex' object has no attribute 'isocalendar'")
338337

339-
if LooseVersion(pd.__version__) < "1.1.0":
340-
raise AttributeError("'isocalendar' not available in pandas < 1.1.0")
341-
342338
values = _get_date_field(self._obj.data, "isocalendar", np.int64)
343339

344340
obj_type = type(self._obj)
@@ -383,12 +379,7 @@ def weekofyear(self):
383379
FutureWarning,
384380
)
385381

386-
if LooseVersion(pd.__version__) < "1.1.0":
387-
weekofyear = Properties._tslib_field_accessor(
388-
"weekofyear", "The week ordinal of the year", np.int64
389-
).fget(self)
390-
else:
391-
weekofyear = self.isocalendar().week
382+
weekofyear = self.isocalendar().week
392383

393384
return weekofyear
394385

xarray/core/missing.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import datetime as dt
22
import warnings
3-
from distutils.version import LooseVersion
43
from functools import partial
54
from numbers import Number
65
from typing import Any, Callable, Dict, Hashable, Sequence, Union
@@ -557,16 +556,8 @@ def _localize(var, indexes_coords):
557556
"""
558557
indexes = {}
559558
for dim, [x, new_x] in indexes_coords.items():
560-
if np.issubdtype(new_x.dtype, np.datetime64) and LooseVersion(
561-
np.__version__
562-
) < LooseVersion("1.18"):
563-
# np.nanmin/max changed behaviour for datetime types in numpy 1.18,
564-
# see https://github.com/pydata/xarray/pull/3924/files
565-
minval = np.min(new_x.values)
566-
maxval = np.max(new_x.values)
567-
else:
568-
minval = np.nanmin(new_x.values)
569-
maxval = np.nanmax(new_x.values)
559+
minval = np.nanmin(new_x.values)
560+
maxval = np.nanmax(new_x.values)
570561
index = x.to_index()
571562
imin = index.get_loc(minval, method="nearest")
572563
imax = index.get_loc(maxval, method="nearest")

0 commit comments

Comments
 (0)