Skip to content

Commit 14fe7e0

Browse files
authored
try to get the upstream-dev CI to complete again (#8823)
* install upstream-dev h5py and enable h5netcdf again * try installing nightly `pyarrow` [skip-ci] * use `micromamba` to speed up the force-removal of packages * add a missing trailing backslash [skip-ci] * revert the enabling of upstream-dev h5netcdf [skip-ci] * also build `numexpr` * replace the removed `numpy.array_api` with `array-api-strict` * don't install upstream-dev `h5py` * remove `numexpr` from the environment instead [skip-ci] * ignore the missing typing in `array_api_strict` * restore the old `numpy.array_api` import for `numpy<2` * ignore the redefinition of `Array`
1 parent 90e00f0 commit 14fe7e0

9 files changed

+34
-9
lines changed

ci/install-upstream-wheels.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
micromamba install "cython>=0.29.20" py-cpuinfo
55
# temporarily (?) remove numbagg and numba
66
micromamba remove -y numba numbagg
7+
# temporarily remove numexpr
8+
micromamba remove -y numexpr
79
# temporarily remove backends
8-
micromamba remove -y cf_units h5py hdf5 netcdf4
10+
micromamba remove -y cf_units hdf5 h5py netcdf4
911
# forcibly remove packages to avoid artifacts
10-
conda uninstall -y --force \
12+
micromamba remove -y --force \
1113
numpy \
1214
scipy \
1315
pandas \
@@ -30,8 +32,17 @@ python -m pip install \
3032
scipy \
3133
matplotlib \
3234
pandas
35+
# for some reason pandas depends on pyarrow already.
36+
# Remove once a `pyarrow` version compiled with `numpy>=2.0` is on `conda-forge`
37+
python -m pip install \
38+
-i https://pypi.fury.io/arrow-nightlies/ \
39+
--prefer-binary \
40+
--no-deps \
41+
--pre \
42+
--upgrade \
43+
pyarrow
3344
# without build isolation for packages compiling against numpy
34-
# TODO: remove once there are `numpy>=2.0` builds for numcodecs and cftime
45+
# TODO: remove once there are `numpy>=2.0` builds for these
3546
python -m pip install \
3647
--no-deps \
3748
--upgrade \

ci/requirements/all-but-dask.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ channels:
55
dependencies:
66
- black
77
- aiobotocore
8+
- array-api-strict
89
- boto3
910
- bottleneck
1011
- cartopy

ci/requirements/environment-3.12.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ channels:
44
- nodefaults
55
dependencies:
66
- aiobotocore
7+
- array-api-strict
78
- boto3
89
- bottleneck
910
- cartopy

ci/requirements/environment-windows-3.12.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: xarray-tests
22
channels:
33
- conda-forge
44
dependencies:
5+
- array-api-strict
56
- boto3
67
- bottleneck
78
- cartopy

ci/requirements/environment-windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: xarray-tests
22
channels:
33
- conda-forge
44
dependencies:
5+
- array-api-strict
56
- boto3
67
- bottleneck
78
- cartopy

ci/requirements/environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ channels:
44
- nodefaults
55
dependencies:
66
- aiobotocore
7+
- array-api-strict
78
- boto3
89
- bottleneck
910
- cartopy

ci/requirements/min-all-deps.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ dependencies:
88
# When upgrading python, numpy, or pandas, must also change
99
# doc/user-guide/installing.rst, doc/user-guide/plotting.rst and setup.py.
1010
- python=3.9
11+
- array-api-strict=1.0 # dependency for testing the array api compat
1112
- boto3=1.24
1213
- bottleneck=1.3
1314
- cartopy=0.21

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ module = [
138138
"toolz.*",
139139
"zarr.*",
140140
"numpy.exceptions.*", # remove once support for `numpy<2.0` has been dropped
141+
"array_api_strict.*",
141142
]
142143

143144
# Gradually we want to add more modules to this list, ratcheting up our total

xarray/tests/test_array_api.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
from __future__ import annotations
22

3-
import warnings
4-
53
import pytest
64

75
import xarray as xr
86
from xarray.testing import assert_equal
97

108
np = pytest.importorskip("numpy", minversion="1.22")
119

12-
with warnings.catch_warnings():
13-
warnings.simplefilter("ignore")
14-
import numpy.array_api as xp # isort:skip
15-
from numpy.array_api._array_object import Array # isort:skip
10+
try:
11+
import warnings
12+
13+
with warnings.catch_warnings():
14+
warnings.simplefilter("ignore")
15+
16+
import numpy.array_api as xp
17+
from numpy.array_api._array_object import Array
18+
except ImportError:
19+
# for `numpy>=2.0`
20+
xp = pytest.importorskip("array_api_strict")
21+
22+
from array_api_strict._array_object import Array # type: ignore[no-redef]
1623

1724

1825
@pytest.fixture

0 commit comments

Comments
 (0)