Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump minimum numpy version to 1.20 #6834

Merged
merged 28 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
bf01aef
bump minimum numpy version to 1.20
headtr1ck Jul 26, 2022
7fcc11f
remove obsolete code from npcompat
headtr1ck Jul 26, 2022
63199e8
update generate_ops
headtr1ck Jul 26, 2022
16efc58
update whats-new
headtr1ck Jul 26, 2022
a608170
fix a typing runtime issue
headtr1ck Jul 26, 2022
3d8aeb4
Merge branch 'main' into bumpnumpy
headtr1ck Oct 5, 2022
b787014
remove npcompat module
headtr1ck Oct 5, 2022
cb49f86
bump pandas minimum to 1.3 as well
headtr1ck Oct 5, 2022
0764210
bump min packaging to 21
headtr1ck Oct 5, 2022
b48c920
bump min all deps
headtr1ck Oct 5, 2022
66e9019
update new versions in doc
headtr1ck Oct 6, 2022
0e00a7d
bump netcdf4 to 1.5.4
headtr1ck Oct 8, 2022
c79c78f
unify pynio comments
headtr1ck Oct 8, 2022
20dfd86
Update ci/requirements/min-all-deps.yml
dcherian Oct 9, 2022
d863d6e
Update ci/requirements/min-all-deps.yml
dcherian Oct 9, 2022
d17a9a9
revert
dcherian Oct 11, 2022
c9f1bb9
Works.
dcherian Oct 11, 2022
73df8ad
more bumpies
dcherian Oct 11, 2022
5d7f28a
bump cftime
dcherian Oct 11, 2022
802f0a5
more bumpies
dcherian Oct 11, 2022
6302d89
Use numpy to dispatch gradient,sliding_window_view
dcherian Oct 11, 2022
489bd99
bump nc-time-axis to see if it fixes test
dcherian Oct 11, 2022
06a1acb
Merge branch 'main' into bumpnumpy
dcherian Oct 12, 2022
b0c510c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 12, 2022
c719cd4
Restore npcompat
dcherian Oct 12, 2022
9d0e92d
Fix bad merge
dcherian Oct 12, 2022
c7a988b
update whats-new
dcherian Oct 12, 2022
b199d8e
clean up table
dcherian Oct 12, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ci/requirements/all-but-dask.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:
- h5py
- hdf5
- hypothesis
- lxml # Optional dep of pydap
- lxml # Optional dep of pydap
- matplotlib-base
- nc-time-axis
- netcdf4
Expand All @@ -30,7 +30,7 @@ dependencies:
- pip
- pseudonetcdf
- pydap
# - pynio: not compatible with netCDF4>1.5.3; only tested in py37-bare-minimum
# - pynio # not compatible with netCDF4>1.5.3, see #4491
- pytest
- pytest-cov
- pytest-env
Expand Down
6 changes: 3 additions & 3 deletions ci/requirements/bare-minimum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ dependencies:
- pytest-cov
- pytest-env
- pytest-xdist
- numpy=1.19
- packaging=20.0
- pandas=1.2
- numpy=1.20
- packaging=21.0
- pandas=1.3
6 changes: 3 additions & 3 deletions ci/requirements/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ dependencies:
- nbsphinx
- netcdf4>=1.5
- numba
- numpy>=1.17
- packaging>=20.0
- pandas>=1.0
- numpy>=1.20
- packaging>=21.0
- pandas>=1.3
- pooch
- pip
- pydata-sphinx-theme>=0.4.3
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/environment-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
- hdf5
- hypothesis
- iris
- lxml # Optional dep of pydap
- lxml # Optional dep of pydap
- matplotlib-base
- nc-time-axis
- netcdf4
Expand Down
4 changes: 2 additions & 2 deletions ci/requirements/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
- hdf5
- hypothesis
- iris
- lxml # Optional dep of pydap
- lxml # Optional dep of pydap
- matplotlib-base
- nc-time-axis
- netcdf4
Expand All @@ -34,7 +34,7 @@ dependencies:
- pre-commit
- pseudonetcdf
- pydap
# - pynio: not compatible with netCDF4>1.5.3; only tested in py37-bare-minimum
# - pynio # not compatible with netCDF4>1.5.3, see #4491
- pytest
- pytest-cov
- pytest-env
Expand Down
32 changes: 17 additions & 15 deletions ci/requirements/min-all-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,35 @@ dependencies:
# When upgrading python, numpy, or pandas, must also change
# doc/installing.rst and setup.py.
- python=3.8
- boto3=1.13
- boto3=1.18
- bottleneck=1.3
- cartopy=0.19
- cdms2=3.1
dcherian marked this conversation as resolved.
Show resolved Hide resolved
- cfgrib=0.9
- cftime=1.4
- cftime=1.5
- coveralls
- dask-core=2021.08.0
- distributed=2021.08.0
- dask-core=2021.09
- distributed=2021.09
- flox=0.5
- h5netcdf=0.11
# h5py and hdf5 tend to cause conflicrs
# for e.g. hdf5 1.12 conflicts with h5py=3.1
# prioritize bumping other packages instead
- h5py=3.1
# hdf5 1.12 conflicts with h5py=3.1
- hdf5=1.10
- hypothesis
- iris=2.4
- iris=3.1
- lxml=4.6 # Optional dep of pydap
- matplotlib-base=3.4
- nc-time-axis=1.2
- nc-time-axis=1.3
# netcdf follows a 1.major.minor[.patch] convention
# (see https://github.com/Unidata/netcdf4-python/issues/1090)
# bumping the netCDF4 version is currently blocked by #4491
- netcdf4=1.5.3
- numba=0.53
- numpy=1.19
- packaging=20.0
- pandas=1.2
- numba=0.54
- numpy=1.20
- packaging=21.0
- pandas=1.3
- pint=0.17
- pip
- pseudonetcdf=3.1
Expand All @@ -45,11 +47,11 @@ dependencies:
- pytest-env
- pytest-xdist
- rasterio=1.2
- scipy=1.6
- scipy=1.7
- seaborn=0.11
- sparse=0.12
- sparse=0.13
- toolz=0.11
- typing_extensions=3.7
- zarr=2.8
- typing_extensions=3.10
- zarr=2.10
- pip:
- numbagg==0.1
6 changes: 3 additions & 3 deletions doc/getting-started-guide/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Required dependencies
---------------------

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

.. _optional-dependencies:

Expand Down
20 changes: 20 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@ New Features
Breaking changes
~~~~~~~~~~~~~~~~

- The minimum versions of some dependencies were changed:

========================== ========= ========
Package Old New
========================== ========= ========
cftime 1.4 1.5
distributed 2021.08 2021.09
dask 2021.08 2021.09
iris 2.4 3.1
nc-time-axis 1.2 1.3
numba 0.53 0.54
numpy 1.19 1.20
pandas 1.2 1.3
packaging 20.0 21.0
scipy 1.6 1.7
sparse 0.12 0.13
typing_extensions 3.7 3.10
zarr 2.8 2.10
========================== ========= ========


Deprecations
~~~~~~~~~~~~
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# it exists to let GitHub build the repository dependency graph
# https://help.github.com/en/github/visualizing-repository-data-with-graphs/listing-the-packages-that-a-repository-depends-on

numpy >= 1.18
packaging >= 20.0
pandas >= 1.1
numpy >= 1.20
packaging >= 21.0
pandas >= 1.3
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ zip_safe = False # https://mypy.readthedocs.io/en/latest/installed_packages.htm
include_package_data = True
python_requires = >=3.8
install_requires =
numpy >= 1.19 # recommended to use >= 1.22 for full quantile method support
pandas >= 1.2
packaging >= 20.0
numpy >= 1.20 # recommended to use >= 1.22 for full quantile method support
pandas >= 1.3
packaging >= 21.0

[options.extras_require]
io =
Expand Down
2 changes: 1 addition & 1 deletion xarray/core/_typed_ops.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from typing import NoReturn, TypeVar, overload

import numpy as np
from numpy.typing import ArrayLike

from .dataarray import DataArray
from .dataset import Dataset
from .groupby import DataArrayGroupBy, DatasetGroupBy, GroupBy
from .npcompat import ArrayLike
from .types import (
DaCompatible,
DsCompatible,
Expand Down
3 changes: 2 additions & 1 deletion xarray/core/accessor_dt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
is_np_datetime_like,
is_np_timedelta_like,
)
from .npcompat import DTypeLike
from .pycompat import is_duck_dask_array
from .types import T_DataArray

if TYPE_CHECKING:
from numpy.typing import DTypeLike

from .dataarray import DataArray
from .dataset import Dataset
from .types import CFCalendar
Expand Down
3 changes: 2 additions & 1 deletion xarray/core/accessor_str.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@
import numpy as np

from .computation import apply_ufunc
from .npcompat import DTypeLike
from .types import T_DataArray

if TYPE_CHECKING:
from numpy.typing import DTypeLike

from .dataarray import DataArray

_cpython_optimized_encoders = (
Expand Down
10 changes: 5 additions & 5 deletions xarray/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import pandas as pd

from . import dtypes, duck_array_ops, formatting, formatting_html, ops
from .npcompat import DTypeLike, DTypeLikeSave
from .options import OPTIONS, _get_keep_attrs
from .pycompat import is_duck_dask_array
from .utils import Frozen, either_dict_or_kwargs, is_scalar
Expand All @@ -38,14 +37,18 @@
if TYPE_CHECKING:
import datetime

from numpy.typing import DTypeLike

from .dataarray import DataArray
from .dataset import Dataset
from .indexes import Index
from .resample import Resample
from .rolling_exp import RollingExp
from .types import ScalarOrArray, SideOptions, T_DataWithCoords
from .types import DTypeLikeSave, ScalarOrArray, SideOptions, T_DataWithCoords
from .variable import Variable

DTypeMaybeMapping = Union[DTypeLikeSave, Mapping[Any, DTypeLikeSave]]


T_Resample = TypeVar("T_Resample", bound="Resample")
C = TypeVar("C")
Expand Down Expand Up @@ -1344,9 +1347,6 @@ def __getitem__(self, value):
raise NotImplementedError()


DTypeMaybeMapping = Union[DTypeLikeSave, Mapping[Any, DTypeLikeSave]]


@overload
def full_like(
other: DataArray, fill_value: Any, dtype: DTypeLikeSave = None
Expand Down
8 changes: 5 additions & 3 deletions xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
)
from .indexing import is_fancy_indexer, map_index_queries
from .merge import PANDAS_TYPES, MergeError, _create_indexes_from_coords
from .npcompat import QUANTILE_METHODS, ArrayLike
from .options import OPTIONS, _get_keep_attrs
from .utils import (
Default,
Expand All @@ -58,6 +57,8 @@
if TYPE_CHECKING:
from typing import TypeVar, Union

from numpy.typing import ArrayLike

try:
from dask.delayed import Delayed
except ImportError:
Expand All @@ -84,6 +85,7 @@
InterpOptions,
PadModeOptions,
PadReflectOptions,
QuantileMethods,
QueryEngineOptions,
QueryParserOptions,
ReindexMethodOptions,
Expand Down Expand Up @@ -4517,10 +4519,10 @@ def quantile(
self: T_DataArray,
q: ArrayLike,
dim: Dims = None,
method: QUANTILE_METHODS = "linear",
method: QuantileMethods = "linear",
keep_attrs: bool | None = None,
skipna: bool | None = None,
interpolation: QUANTILE_METHODS = None,
interpolation: QuantileMethods = None,
) -> T_DataArray:
"""Compute the qth quantile of the data along the specified dimension.

Expand Down
9 changes: 5 additions & 4 deletions xarray/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@
merge_data_and_coords,
)
from .missing import get_clean_interp_index
from .npcompat import QUANTILE_METHODS, ArrayLike
from .options import OPTIONS, _get_keep_attrs
from .pycompat import is_duck_dask_array, sparse_array_type
from .types import T_Dataset
from .types import QuantileMethods, T_Dataset
from .utils import (
Default,
Frozen,
Expand All @@ -93,6 +92,8 @@
)

if TYPE_CHECKING:
from numpy.typing import ArrayLike

from ..backends import AbstractDataStore, ZarrStore
from ..backends.api import T_NetcdfEngine, T_NetcdfTypes
from .coordinates import Coordinates
Expand Down Expand Up @@ -6969,11 +6970,11 @@ def quantile(
self: T_Dataset,
q: ArrayLike,
dim: Dims = None,
method: QUANTILE_METHODS = "linear",
method: QuantileMethods = "linear",
numeric_only: bool = False,
keep_attrs: bool = None,
skipna: bool = None,
interpolation: QUANTILE_METHODS = None,
interpolation: QuantileMethods = None,
) -> T_Dataset:
"""Compute the qth quantile of the data along the specified dimension.

Expand Down
Loading