Skip to content

Commit

Permalink
Remove ad-hoc handling of NEP18 libraries in CI (#5740)
Browse files Browse the repository at this point in the history
* CI versions refresh

* docs

* Update xarray/tests/test_ufuncs.py

Co-authored-by: Mathias Hauser <mathause@users.noreply.github.com>

* Update xarray/ufuncs.py

Co-authored-by: Mathias Hauser <mathause@users.noreply.github.com>

Co-authored-by: Mathias Hauser <mathause@users.noreply.github.com>
  • Loading branch information
crusaderky and mathause authored Aug 31, 2021
1 parent 8c9c0f6 commit 675f362
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 54 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci-additional.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ jobs:
[
"py37-bare-minimum",
"py37-min-all-deps",
"py37-min-nep18",
"py38-all-but-dask",
"py38-flaky",
]
Expand Down
9 changes: 5 additions & 4 deletions ci/requirements/py37-min-all-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
22 changes: 0 additions & 22 deletions ci/requirements/py37-min-nep18.yml

This file was deleted.

11 changes: 1 addition & 10 deletions doc/getting-started-guide/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@ dependencies:
- **setuptools:** 42 months (but no older than 40.4)
- **numpy:** 18 months
(`NEP-29 <https://numpy.org/neps/nep-0029-deprecation_policy.html>`_)
- **dask and dask.distributed:** 12 months
- **sparse, pint** and other libraries that rely on
`NEP-18 <https://numpy.org/neps/nep-0018-array-function-protocol.html>`_
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)
Expand All @@ -109,10 +103,7 @@ release is guaranteed to work.

You can see the actual minimum tested versions:

- `For NEP-18 libraries
<https://github.com/pydata/xarray/blob/main/ci/requirements/py37-min-nep18.yml>`_
- `For everything else
<https://github.com/pydata/xarray/blob/main/ci/requirements/py37-min-all-deps.yml>`_
`<https://github.com/pydata/xarray/blob/main/ci/requirements/py37-min-all-deps.yml>`_

.. _installation-instructions:

Expand Down
16 changes: 7 additions & 9 deletions doc/user-guide/dask.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <api.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 <xarray.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:
Expand All @@ -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:

Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions xarray/tests/test_ufuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,11 @@ def test_gufuncs():


def test_xarray_ufuncs_deprecation():
with pytest.warns(PendingDeprecationWarning, match="xarray.ufuncs"):
with pytest.warns(FutureWarning, 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


Expand Down
6 changes: 2 additions & 4 deletions xarray/ufuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
FutureWarning,
stacklevel=2,
)

Expand Down

0 comments on commit 675f362

Please sign in to comment.