From a0dcc2e5adfc306dcd1b893a6c16d173b335a89c Mon Sep 17 00:00:00 2001 From: crusaderky Date: Thu, 26 Aug 2021 14:03:14 +0100 Subject: [PATCH 1/4] CI versions refresh --- .github/workflows/ci-additional.yaml | 1 - ci/requirements/py37-min-all-deps.yml | 9 +++++---- ci/requirements/py37-min-nep18.yml | 22 ---------------------- doc/getting-started-guide/installing.rst | 11 +---------- requirements.txt | 5 +++-- xarray/tests/test_ufuncs.py | 3 +-- xarray/ufuncs.py | 6 ++---- 7 files changed, 12 insertions(+), 45 deletions(-) delete mode 100644 ci/requirements/py37-min-nep18.yml diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 2b9a6405f21..0c1f7e9c879 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -42,7 +42,6 @@ jobs: [ "py37-bare-minimum", "py37-min-all-deps", - "py37-min-nep18", "py38-all-but-dask", "py38-flaky", ] diff --git a/ci/requirements/py37-min-all-deps.yml b/ci/requirements/py37-min-all-deps.yml index 7743a086db0..156d582ab67 100644 --- a/ci/requirements/py37-min-all-deps.yml +++ b/ci/requirements/py37-min-all-deps.yml @@ -25,13 +25,14 @@ dependencies: - lxml=4.5 # Optional dep of pydap - matplotlib-base=3.2 - nc-time-axis=1.2 -# 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 + # 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.49 - numpy=1.17 - pandas=1.0 - # - pint # See py37-min-nep18.yml + - pint=0.15 - pip - pseudonetcdf=3.1 - pydap=3.2 @@ -44,7 +45,7 @@ dependencies: - scipy=1.4 - seaborn=0.10 - setuptools=40.4 - # - sparse # See py37-min-nep18.yml + - sparse=0.8 - toolz=0.10 - zarr=2.4 - pip: diff --git a/ci/requirements/py37-min-nep18.yml b/ci/requirements/py37-min-nep18.yml deleted file mode 100644 index aea86261a0e..00000000000 --- a/ci/requirements/py37-min-nep18.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: xarray-tests -channels: - - conda-forge - - nodefaults -dependencies: - # Optional dependencies that require NEP18, such as sparse and pint, - # require drastically newer packages than everything else - - python=3.7 - - coveralls - - dask=2.9 - - distributed=2.9 - - numpy=1.17 - - pandas=0.25 - - pint=0.15 - - pip - - pytest - - pytest-cov - - pytest-env - - pytest-xdist - - scipy=1.3 - - setuptools=40.4 - - sparse=0.8 diff --git a/doc/getting-started-guide/installing.rst b/doc/getting-started-guide/installing.rst index 2411a2c67ba..6619b3a9d25 100644 --- a/doc/getting-started-guide/installing.rst +++ b/doc/getting-started-guide/installing.rst @@ -96,12 +96,6 @@ dependencies: - **setuptools:** 42 months (but no older than 40.4) - **numpy:** 18 months (`NEP-29 `_) -- **dask and dask.distributed:** 12 months -- **sparse, pint** and other libraries that rely on - `NEP-18 `_ - for integration: very latest available versions only, until the technology will have - matured. This extends to dask when used in conjunction with any of these libraries. - numpy >=1.17. - **all other libraries:** 12 months This means the latest minor (X.Y) version from N months prior. Patch versions (x.y.Z) @@ -110,10 +104,7 @@ release is guaranteed to work. You can see the actual minimum tested versions: -- `For NEP-18 libraries - `_ -- `For everything else - `_ +``_ .. _installation-instructions: diff --git a/requirements.txt b/requirements.txt index 23eff8f07cb..732d40cde18 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ # 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.15 -pandas >= 0.25 +numpy >= 1.17 +pandas >= 1.0 setuptools >= 40.4 +typing-extensions >= 3.10 diff --git a/xarray/tests/test_ufuncs.py b/xarray/tests/test_ufuncs.py index e8c3af4518f..1d6694c7874 100644 --- a/xarray/tests/test_ufuncs.py +++ b/xarray/tests/test_ufuncs.py @@ -161,12 +161,11 @@ def test_gufuncs(): def test_xarray_ufuncs_deprecation(): - with pytest.warns(PendingDeprecationWarning, match="xarray.ufuncs"): + with pytest.warns(DeprecationWarning, match="xarray.ufuncs"): xu.cos(xr.DataArray([0, 1])) with pytest.warns(None) as record: xu.angle(xr.DataArray([0, 1])) - record = [el.message for el in record if el.category == PendingDeprecationWarning] assert len(record) == 0 diff --git a/xarray/ufuncs.py b/xarray/ufuncs.py index bf80dcf68cd..6e604a88a31 100644 --- a/xarray/ufuncs.py +++ b/xarray/ufuncs.py @@ -46,10 +46,8 @@ def __init__(self, name): def __call__(self, *args, **kwargs): if self._name not in ["angle", "iscomplex"]: _warnings.warn( - "xarray.ufuncs will be deprecated when xarray no longer " - "supports versions of numpy older than v1.17. Instead, use " - "numpy ufuncs directly.", - PendingDeprecationWarning, + "xarray.ufuncs is deprecated. Instead, use numpy ufuncs directly.", + DeprecationWarning, stacklevel=2, ) From f372aabd0c4b466d0e3f1cd3dd656d1e5673d462 Mon Sep 17 00:00:00 2001 From: crusaderky Date: Thu, 26 Aug 2021 14:25:55 +0100 Subject: [PATCH 2/4] docs --- doc/user-guide/dask.rst | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/doc/user-guide/dask.rst b/doc/user-guide/dask.rst index 321b7712b9f..8c6c808d89e 100644 --- a/doc/user-guide/dask.rst +++ b/doc/user-guide/dask.rst @@ -259,18 +259,16 @@ along a particular dimension, an exception is raised when you try to access arrays in a dataset share the same chunking alignment. Neither of these are currently done. -NumPy ufuncs like ``np.sin`` currently only work on eagerly evaluated arrays -(this will change with the next major NumPy release). We have provided -replacements that also work on all xarray objects, including those that store -lazy Dask arrays, in the :ref:`xarray.ufuncs ` module: +NumPy ufuncs like ``np.sin`` transparently work on all xarray objects, including those +that store lazy Dask arrays: .. ipython:: python - import xarray.ufuncs as xu + import numpy as np - xu.sin(rechunked) + np.sin(rechunked) -To access Dask arrays directly, use the new +To access Dask arrays directly, use the :py:attr:`DataArray.data ` attribute. This attribute exposes array data either as a Dask array or as a NumPy array, depending on whether it has been loaded into Dask or not: @@ -281,8 +279,8 @@ loaded into Dask or not: .. note:: - In the future, we may extend ``.data`` to support other "computable" array - backends beyond Dask and NumPy (e.g., to support sparse arrays). + ``.data`` is also used to expose other "computable" array backends beyond Dask and + NumPy (e.g. sparse and pint arrays). .. _dask.automatic-parallelization: From cb09da42d64b801f0dd1f9842be3decce7d7defd Mon Sep 17 00:00:00 2001 From: crusaderky Date: Tue, 31 Aug 2021 10:15:52 +0100 Subject: [PATCH 3/4] Update xarray/tests/test_ufuncs.py Co-authored-by: Mathias Hauser --- xarray/tests/test_ufuncs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/tests/test_ufuncs.py b/xarray/tests/test_ufuncs.py index 1d6694c7874..3379fba44f8 100644 --- a/xarray/tests/test_ufuncs.py +++ b/xarray/tests/test_ufuncs.py @@ -161,7 +161,7 @@ def test_gufuncs(): def test_xarray_ufuncs_deprecation(): - with pytest.warns(DeprecationWarning, match="xarray.ufuncs"): + with pytest.warns(FutureWarning, match="xarray.ufuncs"): xu.cos(xr.DataArray([0, 1])) with pytest.warns(None) as record: From ffddb2e137d3b308d870026a0bc7054cdb1ce09b Mon Sep 17 00:00:00 2001 From: crusaderky Date: Tue, 31 Aug 2021 10:15:56 +0100 Subject: [PATCH 4/4] Update xarray/ufuncs.py Co-authored-by: Mathias Hauser --- xarray/ufuncs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/ufuncs.py b/xarray/ufuncs.py index 6e604a88a31..b80175273e0 100644 --- a/xarray/ufuncs.py +++ b/xarray/ufuncs.py @@ -47,7 +47,7 @@ def __call__(self, *args, **kwargs): if self._name not in ["angle", "iscomplex"]: _warnings.warn( "xarray.ufuncs is deprecated. Instead, use numpy ufuncs directly.", - DeprecationWarning, + FutureWarning, stacklevel=2, )