Skip to content

Commit 242d87d

Browse files
headtr1ckdcherianpre-commit-ci[bot]
authored
Bump minimum numpy version to 1.20 (#6834)
Co-authored-by: Deepak Cherian <dcherian@users.noreply.github.com> Co-authored-by: dcherian <deepak@cherian.net> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent b80d973 commit 242d87d

26 files changed

+165
-308
lines changed

ci/requirements/all-but-dask.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
- h5py
1919
- hdf5
2020
- hypothesis
21-
- lxml # Optional dep of pydap
21+
- lxml # Optional dep of pydap
2222
- matplotlib-base
2323
- nc-time-axis
2424
- netcdf4
@@ -30,7 +30,7 @@ dependencies:
3030
- pip
3131
- pseudonetcdf
3232
- pydap
33-
# - pynio: not compatible with netCDF4>1.5.3; only tested in py37-bare-minimum
33+
# - pynio # not compatible with netCDF4>1.5.3, see #4491
3434
- pytest
3535
- pytest-cov
3636
- pytest-env

ci/requirements/bare-minimum.yml

Lines changed: 3 additions & 3 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.19
14-
- packaging=20.0
15-
- pandas=1.2
13+
- numpy=1.20
14+
- packaging=21.0
15+
- pandas=1.3

ci/requirements/doc.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ dependencies:
1818
- nbsphinx
1919
- netcdf4>=1.5
2020
- numba
21-
- numpy>=1.17
22-
- packaging>=20.0
23-
- pandas>=1.0
21+
- numpy>=1.20
22+
- packaging>=21.0
23+
- pandas>=1.3
2424
- pooch
2525
- pip
2626
- pydata-sphinx-theme>=0.4.3

ci/requirements/environment-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies:
1717
- hdf5
1818
- hypothesis
1919
- iris
20-
- lxml # Optional dep of pydap
20+
- lxml # Optional dep of pydap
2121
- matplotlib-base
2222
- nc-time-axis
2323
- netcdf4

ci/requirements/environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies:
1919
- hdf5
2020
- hypothesis
2121
- iris
22-
- lxml # Optional dep of pydap
22+
- lxml # Optional dep of pydap
2323
- matplotlib-base
2424
- nc-time-axis
2525
- netcdf4
@@ -34,7 +34,7 @@ dependencies:
3434
- pre-commit
3535
- pseudonetcdf
3636
- pydap
37-
# - pynio: not compatible with netCDF4>1.5.3; only tested in py37-bare-minimum
37+
# - pynio # not compatible with netCDF4>1.5.3, see #4491
3838
- pytest
3939
- pytest-cov
4040
- pytest-env

ci/requirements/min-all-deps.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,35 @@ dependencies:
88
# When upgrading python, numpy, or pandas, must also change
99
# doc/installing.rst and setup.py.
1010
- python=3.8
11-
- boto3=1.13
11+
- boto3=1.18
1212
- bottleneck=1.3
1313
- cartopy=0.19
1414
- cdms2=3.1
1515
- cfgrib=0.9
16-
- cftime=1.4
16+
- cftime=1.5
1717
- coveralls
18-
- dask-core=2021.08.0
19-
- distributed=2021.08.0
18+
- dask-core=2021.09
19+
- distributed=2021.09
2020
- flox=0.5
2121
- h5netcdf=0.11
22+
# h5py and hdf5 tend to cause conflicrs
23+
# for e.g. hdf5 1.12 conflicts with h5py=3.1
24+
# prioritize bumping other packages instead
2225
- h5py=3.1
23-
# hdf5 1.12 conflicts with h5py=3.1
2426
- hdf5=1.10
2527
- hypothesis
26-
- iris=2.4
28+
- iris=3.1
2729
- lxml=4.6 # Optional dep of pydap
2830
- matplotlib-base=3.4
29-
- nc-time-axis=1.2
31+
- nc-time-axis=1.3
3032
# netcdf follows a 1.major.minor[.patch] convention
3133
# (see https://github.com/Unidata/netcdf4-python/issues/1090)
3234
# bumping the netCDF4 version is currently blocked by #4491
3335
- netcdf4=1.5.3
34-
- numba=0.53
35-
- numpy=1.19
36-
- packaging=20.0
37-
- pandas=1.2
36+
- numba=0.54
37+
- numpy=1.20
38+
- packaging=21.0
39+
- pandas=1.3
3840
- pint=0.17
3941
- pip
4042
- pseudonetcdf=3.1
@@ -45,11 +47,11 @@ dependencies:
4547
- pytest-env
4648
- pytest-xdist
4749
- rasterio=1.2
48-
- scipy=1.6
50+
- scipy=1.7
4951
- seaborn=0.11
50-
- sparse=0.12
52+
- sparse=0.13
5153
- toolz=0.11
52-
- typing_extensions=3.7
53-
- zarr=2.8
54+
- typing_extensions=3.10
55+
- zarr=2.10
5456
- pip:
5557
- numbagg==0.1

doc/getting-started-guide/installing.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ Required dependencies
77
---------------------
88

99
- Python (3.8 or later)
10-
- `numpy <https://www.numpy.org/>`__ (1.19 or later)
11-
- `packaging <https://packaging.pypa.io/en/latest/#>`__ (20.0 or later)
12-
- `pandas <https://pandas.pydata.org/>`__ (1.2 or later)
10+
- `numpy <https://www.numpy.org/>`__ (1.20 or later)
11+
- `packaging <https://packaging.pypa.io/en/latest/#>`__ (21.0 or later)
12+
- `pandas <https://pandas.pydata.org/>`__ (1.3 or later)
1313

1414
.. _optional-dependencies:
1515

doc/whats-new.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,26 @@ New Features
3232
Breaking changes
3333
~~~~~~~~~~~~~~~~
3434

35+
- The minimum versions of some dependencies were changed:
36+
37+
========================== ========= ========
38+
Package Old New
39+
========================== ========= ========
40+
cftime 1.4 1.5
41+
distributed 2021.08 2021.09
42+
dask 2021.08 2021.09
43+
iris 2.4 3.1
44+
nc-time-axis 1.2 1.3
45+
numba 0.53 0.54
46+
numpy 1.19 1.20
47+
pandas 1.2 1.3
48+
packaging 20.0 21.0
49+
scipy 1.6 1.7
50+
sparse 0.12 0.13
51+
typing_extensions 3.7 3.10
52+
zarr 2.8 2.10
53+
========================== ========= ========
54+
3555

3656
Deprecations
3757
~~~~~~~~~~~~

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
# it exists to let GitHub build the repository dependency graph
33
# https://help.github.com/en/github/visualizing-repository-data-with-graphs/listing-the-packages-that-a-repository-depends-on
44

5-
numpy >= 1.18
6-
packaging >= 20.0
7-
pandas >= 1.1
5+
numpy >= 1.20
6+
packaging >= 21.0
7+
pandas >= 1.3

setup.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ zip_safe = False # https://mypy.readthedocs.io/en/latest/installed_packages.htm
7575
include_package_data = True
7676
python_requires = >=3.8
7777
install_requires =
78-
numpy >= 1.19 # recommended to use >= 1.22 for full quantile method support
79-
pandas >= 1.2
80-
packaging >= 20.0
78+
numpy >= 1.20 # recommended to use >= 1.22 for full quantile method support
79+
pandas >= 1.3
80+
packaging >= 21.0
8181

8282
[options.extras_require]
8383
io =

xarray/core/_typed_ops.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
from typing import NoReturn, TypeVar, overload
55

66
import numpy as np
7+
from numpy.typing import ArrayLike
78

89
from .dataarray import DataArray
910
from .dataset import Dataset
1011
from .groupby import DataArrayGroupBy, DatasetGroupBy, GroupBy
11-
from .npcompat import ArrayLike
1212
from .types import (
1313
DaCompatible,
1414
DsCompatible,

xarray/core/accessor_dt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
is_np_datetime_like,
1313
is_np_timedelta_like,
1414
)
15-
from .npcompat import DTypeLike
1615
from .pycompat import is_duck_dask_array
1716
from .types import T_DataArray
1817

1918
if TYPE_CHECKING:
19+
from numpy.typing import DTypeLike
20+
2021
from .dataarray import DataArray
2122
from .dataset import Dataset
2223
from .types import CFCalendar

xarray/core/accessor_str.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@
5050
import numpy as np
5151

5252
from .computation import apply_ufunc
53-
from .npcompat import DTypeLike
5453
from .types import T_DataArray
5554

5655
if TYPE_CHECKING:
56+
from numpy.typing import DTypeLike
57+
5758
from .dataarray import DataArray
5859

5960
_cpython_optimized_encoders = (

xarray/core/common.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import pandas as pd
2222

2323
from . import dtypes, duck_array_ops, formatting, formatting_html, ops
24-
from .npcompat import DTypeLike, DTypeLikeSave
2524
from .options import OPTIONS, _get_keep_attrs
2625
from .pycompat import is_duck_dask_array
2726
from .utils import Frozen, either_dict_or_kwargs, is_scalar
@@ -38,14 +37,18 @@
3837
if TYPE_CHECKING:
3938
import datetime
4039

40+
from numpy.typing import DTypeLike
41+
4142
from .dataarray import DataArray
4243
from .dataset import Dataset
4344
from .indexes import Index
4445
from .resample import Resample
4546
from .rolling_exp import RollingExp
46-
from .types import ScalarOrArray, SideOptions, T_DataWithCoords
47+
from .types import DTypeLikeSave, ScalarOrArray, SideOptions, T_DataWithCoords
4748
from .variable import Variable
4849

50+
DTypeMaybeMapping = Union[DTypeLikeSave, Mapping[Any, DTypeLikeSave]]
51+
4952

5053
T_Resample = TypeVar("T_Resample", bound="Resample")
5154
C = TypeVar("C")
@@ -1344,9 +1347,6 @@ def __getitem__(self, value):
13441347
raise NotImplementedError()
13451348

13461349

1347-
DTypeMaybeMapping = Union[DTypeLikeSave, Mapping[Any, DTypeLikeSave]]
1348-
1349-
13501350
@overload
13511351
def full_like(
13521352
other: DataArray, fill_value: Any, dtype: DTypeLikeSave = None

xarray/core/dataarray.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
)
4545
from .indexing import is_fancy_indexer, map_index_queries
4646
from .merge import PANDAS_TYPES, MergeError, _create_indexes_from_coords
47-
from .npcompat import QUANTILE_METHODS, ArrayLike
4847
from .options import OPTIONS, _get_keep_attrs
4948
from .utils import (
5049
Default,
@@ -58,6 +57,8 @@
5857
if TYPE_CHECKING:
5958
from typing import TypeVar, Union
6059

60+
from numpy.typing import ArrayLike
61+
6162
try:
6263
from dask.delayed import Delayed
6364
except ImportError:
@@ -84,6 +85,7 @@
8485
InterpOptions,
8586
PadModeOptions,
8687
PadReflectOptions,
88+
QuantileMethods,
8789
QueryEngineOptions,
8890
QueryParserOptions,
8991
ReindexMethodOptions,
@@ -4517,10 +4519,10 @@ def quantile(
45174519
self: T_DataArray,
45184520
q: ArrayLike,
45194521
dim: Dims = None,
4520-
method: QUANTILE_METHODS = "linear",
4522+
method: QuantileMethods = "linear",
45214523
keep_attrs: bool | None = None,
45224524
skipna: bool | None = None,
4523-
interpolation: QUANTILE_METHODS = None,
4525+
interpolation: QuantileMethods = None,
45244526
) -> T_DataArray:
45254527
"""Compute the qth quantile of the data along the specified dimension.
45264528

xarray/core/dataset.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@
6666
merge_data_and_coords,
6767
)
6868
from .missing import get_clean_interp_index
69-
from .npcompat import QUANTILE_METHODS, ArrayLike
7069
from .options import OPTIONS, _get_keep_attrs
7170
from .pycompat import is_duck_dask_array, sparse_array_type
72-
from .types import T_Dataset
71+
from .types import QuantileMethods, T_Dataset
7372
from .utils import (
7473
Default,
7574
Frozen,
@@ -93,6 +92,8 @@
9392
)
9493

9594
if TYPE_CHECKING:
95+
from numpy.typing import ArrayLike
96+
9697
from ..backends import AbstractDataStore, ZarrStore
9798
from ..backends.api import T_NetcdfEngine, T_NetcdfTypes
9899
from .coordinates import Coordinates
@@ -6969,11 +6970,11 @@ def quantile(
69696970
self: T_Dataset,
69706971
q: ArrayLike,
69716972
dim: Dims = None,
6972-
method: QUANTILE_METHODS = "linear",
6973+
method: QuantileMethods = "linear",
69736974
numeric_only: bool = False,
69746975
keep_attrs: bool = None,
69756976
skipna: bool = None,
6976-
interpolation: QUANTILE_METHODS = None,
6977+
interpolation: QuantileMethods = None,
69776978
) -> T_Dataset:
69786979
"""Compute the qth quantile of the data along the specified dimension.
69796980

0 commit comments

Comments
 (0)