Skip to content

Commit 4994797

Browse files
committed
Merge branch 'main' into hypothesis-strategies
* main: (214 commits) Adds copy parameter to __array__ for numpy 2.0 (pydata#9393) `numpy 2` compatibility in the `pydap` backend (pydata#9391) pyarrow dependency added to doc environment (pydata#9394) Extend padding functionalities (pydata#9353) refactor GroupBy internals (pydata#9389) Combine `UnsignedIntegerCoder` and `CFMaskCoder` (pydata#9274) passing missing parameters to ZarrStore.open_store when opening a datatree (pydata#9377) Fix tests on big-endian systems (pydata#9380) Improve error message on `ds['x', 'y']` (pydata#9375) Improve error message for missing coordinate index (pydata#9370) Add flaky to TestNetCDF4ViaDaskData (pydata#9373) Make chunk manager an option in `set_options` (pydata#9362) Revise (pydata#9371) Remove duplicate word from docs (pydata#9367) Adding open_groups to BackendEntryPointEngine, NetCDF4BackendEntrypoint, and H5netcdfBackendEntrypoint (pydata#9243) Revise (pydata#9366) Fix rechunking to a frequency with empty bins. (pydata#9364) whats-new entry for dropping python 3.9 (pydata#9359) drop support for `python=3.9` (pydata#8937) Revise (pydata#9357) ...
2 parents 0aab116 + a04d857 commit 4994797

File tree

207 files changed

+10367
-6181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

207 files changed

+10367
-6181
lines changed

.binder/environment.yml

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ dependencies:
2828
- pip
2929
- pooch
3030
- pydap
31-
- pynio
3231
- rasterio
3332
- scipy
3433
- seaborn

.github/release.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
changelog:
2+
exclude:
3+
authors:
4+
- dependabot
5+
- pre-commit-ci

.github/workflows/benchmarks.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
types: [opened, reopened, synchronize, labeled]
66
workflow_dispatch:
77

8+
env:
9+
PR_HEAD_LABEL: ${{ github.event.pull_request.head.label }}
10+
811
jobs:
912
benchmark:
1013
if: ${{ contains( github.event.pull_request.labels.*.name, 'run-benchmark') && github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
@@ -28,8 +31,11 @@ jobs:
2831
environment-name: xarray-tests
2932
cache-environment: true
3033
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}-benchmark"
34+
# add "build" because of https://github.com/airspeed-velocity/asv/issues/1385
3135
create-args: >-
3236
asv
37+
build
38+
mamba
3339
3440
3541
- name: Run benchmarks
@@ -46,10 +52,7 @@ jobs:
4652
# ID this runner
4753
asv machine --yes
4854
echo "Baseline: ${{ github.event.pull_request.base.sha }} (${{ github.event.pull_request.base.label }})"
49-
echo "Contender: ${GITHUB_SHA} (${{ github.event.pull_request.head.label }})"
50-
# Use mamba for env creation
51-
# export CONDA_EXE=$(which mamba)
52-
export CONDA_EXE=$(which conda)
55+
echo "Contender: ${GITHUB_SHA} ($PR_HEAD_LABEL)"
5356
# Run benchmarks for current commit against base
5457
ASV_OPTIONS="--split --show-stderr --factor $ASV_FACTOR"
5558
asv continuous $ASV_OPTIONS ${{ github.event.pull_request.base.sha }} ${GITHUB_SHA} \

.github/workflows/ci-additional.yaml

+15-13
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ concurrency:
1212
group: ${{ github.workflow }}-${{ github.ref }}
1313
cancel-in-progress: true
1414

15+
env:
16+
FORCE_COLOR: 3
17+
1518
jobs:
1619
detect-ci-trigger:
1720
name: detect ci trigger
@@ -35,14 +38,13 @@ jobs:
3538
runs-on: "ubuntu-latest"
3639
needs: detect-ci-trigger
3740
if: needs.detect-ci-trigger.outputs.triggered == 'false'
41+
3842
defaults:
3943
run:
4044
shell: bash -l {0}
41-
4245
env:
4346
CONDA_ENV_FILE: ci/requirements/environment.yml
44-
PYTHON_VERSION: "3.11"
45-
47+
PYTHON_VERSION: "3.12"
4648
steps:
4749
- uses: actions/checkout@v4
4850
with:
@@ -128,7 +130,7 @@ jobs:
128130
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report xarray/
129131
130132
- name: Upload mypy coverage to Codecov
131-
uses: codecov/codecov-action@v4.1.0
133+
uses: codecov/codecov-action@v4.5.0
132134
with:
133135
file: mypy_report/cobertura.xml
134136
flags: mypy
@@ -137,15 +139,15 @@ jobs:
137139
fail_ci_if_error: false
138140

139141
mypy39:
140-
name: Mypy 3.9
142+
name: Mypy 3.10
141143
runs-on: "ubuntu-latest"
142144
needs: detect-ci-trigger
143145
defaults:
144146
run:
145147
shell: bash -l {0}
146148
env:
147149
CONDA_ENV_FILE: ci/requirements/environment.yml
148-
PYTHON_VERSION: "3.9"
150+
PYTHON_VERSION: "3.10"
149151

150152
steps:
151153
- uses: actions/checkout@v4
@@ -182,7 +184,7 @@ jobs:
182184
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report xarray/
183185
184186
- name: Upload mypy coverage to Codecov
185-
uses: codecov/codecov-action@v4.1.0
187+
uses: codecov/codecov-action@v4.5.0
186188
with:
187189
file: mypy_report/cobertura.xml
188190
flags: mypy39
@@ -206,7 +208,7 @@ jobs:
206208
shell: bash -l {0}
207209
env:
208210
CONDA_ENV_FILE: ci/requirements/environment.yml
209-
PYTHON_VERSION: "3.10"
211+
PYTHON_VERSION: "3.12"
210212

211213
steps:
212214
- uses: actions/checkout@v4
@@ -243,7 +245,7 @@ jobs:
243245
python -m pyright xarray/
244246
245247
- name: Upload pyright coverage to Codecov
246-
uses: codecov/codecov-action@v4.1.0
248+
uses: codecov/codecov-action@v4.5.0
247249
with:
248250
file: pyright_report/cobertura.xml
249251
flags: pyright
@@ -252,7 +254,7 @@ jobs:
252254
fail_ci_if_error: false
253255

254256
pyright39:
255-
name: Pyright 3.9
257+
name: Pyright 3.10
256258
runs-on: "ubuntu-latest"
257259
needs: detect-ci-trigger
258260
if: |
@@ -265,7 +267,7 @@ jobs:
265267
shell: bash -l {0}
266268
env:
267269
CONDA_ENV_FILE: ci/requirements/environment.yml
268-
PYTHON_VERSION: "3.9"
270+
PYTHON_VERSION: "3.10"
269271

270272
steps:
271273
- uses: actions/checkout@v4
@@ -302,7 +304,7 @@ jobs:
302304
python -m pyright xarray/
303305
304306
- name: Upload pyright coverage to Codecov
305-
uses: codecov/codecov-action@v4.1.0
307+
uses: codecov/codecov-action@v4.5.0
306308
with:
307309
file: pyright_report/cobertura.xml
308310
flags: pyright39
@@ -331,7 +333,7 @@ jobs:
331333
with:
332334
environment-name: xarray-tests
333335
create-args: >-
334-
python=3.11
336+
python=3.12
335337
pyyaml
336338
conda
337339
python-dateutil

.github/workflows/ci.yaml

+29-13
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ concurrency:
1212
group: ${{ github.workflow }}-${{ github.ref }}
1313
cancel-in-progress: true
1414

15+
env:
16+
FORCE_COLOR: 3
17+
1518
jobs:
1619
detect-ci-trigger:
1720
name: detect ci trigger
@@ -44,22 +47,23 @@ jobs:
4447
matrix:
4548
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
4649
# Bookend python versions
47-
python-version: ["3.9", "3.11", "3.12"]
50+
python-version: ["3.10", "3.12"]
4851
env: [""]
4952
include:
5053
# Minimum python version:
5154
- env: "bare-minimum"
52-
python-version: "3.9"
55+
python-version: "3.10"
5356
os: ubuntu-latest
5457
- env: "min-all-deps"
55-
python-version: "3.9"
58+
python-version: "3.10"
5659
os: ubuntu-latest
5760
# Latest python version:
5861
- env: "all-but-dask"
59-
python-version: "3.10"
62+
# Not 3.12 because of pint
63+
python-version: "3.11"
6064
os: ubuntu-latest
6165
- env: "flaky"
62-
python-version: "3.10"
66+
python-version: "3.12"
6367
os: ubuntu-latest
6468
steps:
6569
- uses: actions/checkout@v4
@@ -71,25 +75,30 @@ jobs:
7175
7276
if [[ ${{ matrix.os }} == windows* ]] ;
7377
then
74-
if [[ ${{ matrix.python-version }} != "3.12" ]]; then
78+
if [[ ${{ matrix.python-version }} != "3.13" ]]; then
7579
echo "CONDA_ENV_FILE=ci/requirements/environment-windows.yml" >> $GITHUB_ENV
7680
else
77-
echo "CONDA_ENV_FILE=ci/requirements/environment-windows-3.12.yml" >> $GITHUB_ENV
81+
echo "CONDA_ENV_FILE=ci/requirements/environment-windows-3.13.yml" >> $GITHUB_ENV
7882
fi
7983
elif [[ "${{ matrix.env }}" != "" ]] ;
8084
then
8185
if [[ "${{ matrix.env }}" == "flaky" ]] ;
8286
then
8387
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV
84-
echo "PYTEST_EXTRA_FLAGS=--run-flaky --run-network-tests" >> $GITHUB_ENV
88+
echo "PYTEST_ADDOPTS=-m 'flaky or network' --run-flaky --run-network-tests -W default" >> $GITHUB_ENV
8589
else
8690
echo "CONDA_ENV_FILE=ci/requirements/${{ matrix.env }}.yml" >> $GITHUB_ENV
8791
fi
92+
if [[ "${{ matrix.env }}" == "min-all-deps" ]] ;
93+
then
94+
# Don't raise on warnings
95+
echo "PYTEST_ADDOPTS=-W default" >> $GITHUB_ENV
96+
fi
8897
else
89-
if [[ ${{ matrix.python-version }} != "3.12" ]]; then
98+
if [[ ${{ matrix.python-version }} != "3.13" ]]; then
9099
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV
91100
else
92-
echo "CONDA_ENV_FILE=ci/requirements/environment-3.12.yml" >> $GITHUB_ENV
101+
echo "CONDA_ENV_FILE=ci/requirements/environment-3.13.yml" >> $GITHUB_ENV
93102
fi
94103
fi
95104
@@ -109,7 +118,7 @@ jobs:
109118
# We only want to install this on one run, because otherwise we'll have
110119
# duplicate annotations.
111120
- name: Install error reporter
112-
if: ${{ matrix.os }} == 'ubuntu-latest' and ${{ matrix.python-version }} == '3.10'
121+
if: ${{ matrix.os }} == 'ubuntu-latest' and ${{ matrix.python-version }} == '3.12'
113122
run: |
114123
python -m pip install pytest-github-actions-annotate-failures
115124
@@ -127,13 +136,20 @@ jobs:
127136
run: |
128137
python -c "import xarray"
129138
139+
- name: Restore cached hypothesis directory
140+
uses: actions/cache@v4
141+
with:
142+
path: .hypothesis/
143+
key: cache-hypothesis
144+
enableCrossOsArchive: true
145+
save-always: true
146+
130147
- name: Run tests
131148
run: python -m pytest -n 4
132149
--timeout 180
133150
--cov=xarray
134151
--cov-report=xml
135152
--junitxml=pytest.xml
136-
$PYTEST_EXTRA_FLAGS
137153

138154
- name: Upload test results
139155
if: always()
@@ -143,7 +159,7 @@ jobs:
143159
path: pytest.xml
144160

145161
- name: Upload code coverage to Codecov
146-
uses: codecov/codecov-action@v4.1.0
162+
uses: codecov/codecov-action@v4.5.0
147163
with:
148164
file: ./coverage.xml
149165
flags: unittests

.github/workflows/hypothesis.yaml

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Slow Hypothesis CI
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
pull_request:
7+
branches:
8+
- "main"
9+
types: [opened, reopened, synchronize, labeled]
10+
schedule:
11+
- cron: "0 0 * * *" # Daily “At 00:00” UTC
12+
workflow_dispatch: # allows you to trigger manually
13+
14+
env:
15+
FORCE_COLOR: 3
16+
17+
jobs:
18+
detect-ci-trigger:
19+
name: detect ci trigger
20+
runs-on: ubuntu-latest
21+
if: |
22+
github.repository == 'pydata/xarray'
23+
&& (github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'schedule')
24+
outputs:
25+
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 2
30+
- uses: xarray-contrib/ci-trigger@v1
31+
id: detect-trigger
32+
with:
33+
keyword: "[skip-ci]"
34+
35+
hypothesis:
36+
name: Slow Hypothesis Tests
37+
runs-on: "ubuntu-latest"
38+
needs: detect-ci-trigger
39+
if: |
40+
always()
41+
&& (
42+
needs.detect-ci-trigger.outputs.triggered == 'false'
43+
&& ( (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
44+
|| contains( github.event.pull_request.labels.*.name, 'run-slow-hypothesis'))
45+
)
46+
defaults:
47+
run:
48+
shell: bash -l {0}
49+
50+
env:
51+
CONDA_ENV_FILE: ci/requirements/environment.yml
52+
PYTHON_VERSION: "3.12"
53+
54+
steps:
55+
- uses: actions/checkout@v4
56+
with:
57+
fetch-depth: 0 # Fetch all history for all branches and tags.
58+
59+
- name: set environment variables
60+
run: |
61+
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
62+
63+
- name: Setup micromamba
64+
uses: mamba-org/setup-micromamba@v1
65+
with:
66+
environment-file: ci/requirements/environment.yml
67+
environment-name: xarray-tests
68+
create-args: >-
69+
python=${{env.PYTHON_VERSION}}
70+
pytest-reportlog
71+
cache-environment: true
72+
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
73+
74+
- name: Install xarray
75+
run: |
76+
python -m pip install --no-deps -e .
77+
- name: Version info
78+
run: |
79+
conda info -a
80+
conda list
81+
python xarray/util/print_versions.py
82+
83+
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
84+
- name: Restore cached hypothesis directory
85+
id: restore-hypothesis-cache
86+
uses: actions/cache/restore@v4
87+
with:
88+
path: .hypothesis/
89+
key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }}
90+
restore-keys: |
91+
cache-hypothesis-
92+
93+
- name: Run slow Hypothesis tests
94+
if: success()
95+
id: status
96+
run: |
97+
python -m pytest --hypothesis-show-statistics --run-slow-hypothesis properties/*.py \
98+
--report-log output-${{ matrix.python-version }}-log.jsonl
99+
100+
# explicitly save the cache so it gets updated, also do this even if it fails.
101+
- name: Save cached hypothesis directory
102+
id: save-hypothesis-cache
103+
if: always() && steps.status.outcome != 'skipped'
104+
uses: actions/cache/save@v4
105+
with:
106+
path: .hypothesis/
107+
key: cache-hypothesis-${{ runner.os }}-${{ github.run_id }}
108+
109+
- name: Generate and publish the report
110+
if: |
111+
failure()
112+
&& steps.status.outcome == 'failure'
113+
&& github.event_name == 'schedule'
114+
&& github.repository_owner == 'pydata'
115+
uses: xarray-contrib/issue-from-pytest-log@v1
116+
with:
117+
log-path: output-${{ matrix.python-version }}-log.jsonl
118+
issue-title: "Nightly Hypothesis tests failed"
119+
issue-label: "topic-hypothesis"

0 commit comments

Comments
 (0)