Skip to content
forked from pydata/xarray

Commit a62628b

Browse files
committed
Merge branch 'main' into custom-groupers
* main: (85 commits) Adds open_datatree and load_datatree to the tutorial module (pydata#10082) Fix version in requires_zarr_v3 fixture (pydata#10145) Fix `open_datatree` when `decode_cf=False` (pydata#10141) [docs] `DataTree` cannot be constructed from `DataArray` (pydata#10142) Refactor datetime and timedelta encoding for increased robustness (pydata#9498) Fix test_distributed::test_async (pydata#10138) Refactor concat / combine / merge into `xarray/structure` (pydata#10134) Split `apply_ufunc` out of `computation.py` (pydata#10133) Refactor modules from `core` into `xarray.computation` (pydata#10132) Refactor compatibility modules into xarray.compat package (pydata#10131) Fix type issues from pandas stubs (pydata#10128) Don't skip tests when on a `mypy` branch (pydata#10129) Change `python_files` in `pyproject.toml` to a list (pydata#10127) Better `uv` compatibility (pydata#10124) explicitly cast the dtype of `where`'s condition parameter to `bool` (pydata#10087) Use `to_numpy` in time decoding (pydata#10081) Pin pandas stubs (pydata#10119) Fix broken Zarr test (pydata#10109) Update asv badge url in README.md (pydata#10113) fix and supress some test warnings (pydata#10104) ...
2 parents bc86751 + bd92782 commit a62628b

File tree

150 files changed

+7656
-3570
lines changed

Some content is hidden

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

150 files changed

+7656
-3570
lines changed

.github/workflows/ci-additional.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ jobs:
116116
python xarray/util/print_versions.py
117117
- name: Install mypy
118118
run: |
119-
python -m pip install "mypy==1.13" --force-reinstall
119+
python -m pip install "mypy==1.15" --force-reinstall
120120
121121
- name: Run mypy
122122
run: |
123123
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
124124
125125
- name: Upload mypy coverage to Codecov
126-
uses: codecov/codecov-action@v5.1.2
126+
uses: codecov/codecov-action@v5.4.0
127127
with:
128128
file: mypy_report/cobertura.xml
129129
flags: mypy
@@ -167,14 +167,14 @@ jobs:
167167
python xarray/util/print_versions.py
168168
- name: Install mypy
169169
run: |
170-
python -m pip install "mypy==1.13" --force-reinstall
170+
python -m pip install "mypy==1.15" --force-reinstall
171171
172172
- name: Run mypy
173173
run: |
174174
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
175175
176176
- name: Upload mypy coverage to Codecov
177-
uses: codecov/codecov-action@v5.1.2
177+
uses: codecov/codecov-action@v5.4.0
178178
with:
179179
file: mypy_report/cobertura.xml
180180
flags: mypy-min
@@ -230,7 +230,7 @@ jobs:
230230
python -m pyright xarray/
231231
232232
- name: Upload pyright coverage to Codecov
233-
uses: codecov/codecov-action@v5.1.2
233+
uses: codecov/codecov-action@v5.4.0
234234
with:
235235
file: pyright_report/cobertura.xml
236236
flags: pyright
@@ -286,7 +286,7 @@ jobs:
286286
python -m pyright xarray/
287287
288288
- name: Upload pyright coverage to Codecov
289-
uses: codecov/codecov-action@v5.1.2
289+
uses: codecov/codecov-action@v5.4.0
290290
with:
291291
file: pyright_report/cobertura.xml
292292
flags: pyright39

.github/workflows/ci.yaml

+24-11
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
matrix:
4848
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
4949
# Bookend python versions
50-
python-version: ["3.10", "3.12"]
50+
python-version: ["3.10", "3.13"]
5151
env: [""]
5252
include:
5353
# Minimum python version:
@@ -59,14 +59,23 @@ jobs:
5959
os: ubuntu-latest
6060
# Latest python version:
6161
- env: "all-but-numba"
62-
python-version: "3.12"
62+
python-version: "3.13"
6363
os: ubuntu-latest
6464
- env: "all-but-dask"
65-
# Not 3.12 because of pint
66-
python-version: "3.11"
65+
python-version: "3.12"
6766
os: ubuntu-latest
6867
- env: "flaky"
69-
python-version: "3.12"
68+
python-version: "3.13"
69+
os: ubuntu-latest
70+
# The mypy tests must be executed using only 1 process in order to guarantee
71+
# predictable mypy output messages for comparison to expectations.
72+
- env: "mypy"
73+
python-version: "3.10"
74+
numprocesses: 1
75+
os: ubuntu-latest
76+
- env: "mypy"
77+
python-version: "3.13"
78+
numprocesses: 1
7079
os: ubuntu-latest
7180
steps:
7281
- uses: actions/checkout@v4
@@ -78,17 +87,21 @@ jobs:
7887
7988
if [[ ${{ matrix.os }} == windows* ]] ;
8089
then
81-
if [[ ${{ matrix.python-version }} != "3.13" ]]; then
90+
if [[ ${{ matrix.python-version }} != "3.14" ]]; then
8291
echo "CONDA_ENV_FILE=ci/requirements/environment-windows.yml" >> $GITHUB_ENV
8392
else
84-
echo "CONDA_ENV_FILE=ci/requirements/environment-windows-3.13.yml" >> $GITHUB_ENV
93+
echo "CONDA_ENV_FILE=ci/requirements/environment-windows-3.14.yml" >> $GITHUB_ENV
8594
fi
8695
elif [[ "${{ matrix.env }}" != "" ]] ;
8796
then
8897
if [[ "${{ matrix.env }}" == "flaky" ]] ;
8998
then
9099
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV
91100
echo "PYTEST_ADDOPTS=-m 'flaky or network' --run-flaky --run-network-tests -W default" >> $GITHUB_ENV
101+
elif [[ "${{ matrix.env }}" == "mypy" ]] ;
102+
then
103+
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV
104+
echo "PYTEST_ADDOPTS=-n 1 -m 'mypy' --run-mypy -W default" >> $GITHUB_ENV
92105
else
93106
echo "CONDA_ENV_FILE=ci/requirements/${{ matrix.env }}.yml" >> $GITHUB_ENV
94107
fi
@@ -98,10 +111,10 @@ jobs:
98111
echo "PYTEST_ADDOPTS=-W default" >> $GITHUB_ENV
99112
fi
100113
else
101-
if [[ ${{ matrix.python-version }} != "3.13" ]]; then
114+
if [[ ${{ matrix.python-version }} != "3.14" ]]; then
102115
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV
103116
else
104-
echo "CONDA_ENV_FILE=ci/requirements/environment-3.13.yml" >> $GITHUB_ENV
117+
echo "CONDA_ENV_FILE=ci/requirements/environment-3.14.yml" >> $GITHUB_ENV
105118
fi
106119
fi
107120
@@ -145,7 +158,7 @@ jobs:
145158
save-always: true
146159

147160
- name: Run tests
148-
run: python -m pytest -n 4
161+
run: python -m pytest -n ${{ matrix.numprocesses || 4 }}
149162
--timeout 180
150163
--cov=xarray
151164
--cov-report=xml
@@ -159,7 +172,7 @@ jobs:
159172
path: pytest.xml
160173

161174
- name: Upload code coverage to Codecov
162-
uses: codecov/codecov-action@v5.1.2
175+
uses: codecov/codecov-action@v5.4.0
163176
env:
164177
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
165178
with:

.github/workflows/pypi-release.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
path: dist
8989
- name: Publish package to TestPyPI
9090
if: github.event_name == 'push'
91-
uses: pypa/[email protected].3
91+
uses: pypa/[email protected].4
9292
with:
9393
repository_url: https://test.pypi.org/legacy/
9494
verbose: true
@@ -110,6 +110,6 @@ jobs:
110110
name: releases
111111
path: dist
112112
- name: Publish package to PyPI
113-
uses: pypa/[email protected].3
113+
uses: pypa/[email protected].4
114114
with:
115115
verbose: true

.github/workflows/upstream-dev-ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ jobs:
140140
run: |
141141
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
142142
- name: Upload mypy coverage to Codecov
143-
uses: codecov/codecov-action@v5.1.2
143+
uses: codecov/codecov-action@v5.4.0
144144
with:
145145
file: mypy_report/cobertura.xml
146146
flags: mypy

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,8 @@ doc/team-panel.txt
8181
doc/external-examples-gallery.txt
8282
doc/notebooks-examples-gallery.txt
8383
doc/videos-gallery.txt
84+
85+
# Until we support this properly, excluding from gitignore. (adding it to
86+
# gitignore to make it _easier_ to work with `uv`, not as an indication that I
87+
# think we shouldn't...)
88+
uv.lock

.pre-commit-config.yaml

+9-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repos:
2525
- id: text-unicode-replacement-char
2626
- repo: https://github.com/astral-sh/ruff-pre-commit
2727
# Ruff version.
28-
rev: v0.8.6
28+
rev: v0.9.9
2929
hooks:
3030
- id: ruff-format
3131
- id: ruff
@@ -37,12 +37,12 @@ repos:
3737
exclude: "generate_aggregations.py"
3838
additional_dependencies: ["black==24.8.0"]
3939
- repo: https://github.com/rbubley/mirrors-prettier
40-
rev: v3.4.2
40+
rev: v3.5.3
4141
hooks:
4242
- id: prettier
4343
args: [--cache-location=.prettier_cache/cache]
4444
- repo: https://github.com/pre-commit/mirrors-mypy
45-
rev: v1.14.1
45+
rev: v1.15.0
4646
hooks:
4747
- id: mypy
4848
# Copied from setup.cfg
@@ -73,3 +73,9 @@ repos:
7373
hooks:
7474
- id: validate-pyproject
7575
additional_dependencies: ["validate-pyproject-schema-store[all]"]
76+
- repo: https://github.com/crate-ci/typos
77+
rev: dictgen-v0.3.1
78+
hooks:
79+
- id: typos
80+
# https://github.com/crate-ci/typos/issues/347
81+
pass_filenames: false

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![CI](https://github.com/pydata/xarray/workflows/CI/badge.svg?branch=main)](https://github.com/pydata/xarray/actions?query=workflow%3ACI)
44
[![Code coverage](https://codecov.io/gh/pydata/xarray/branch/main/graph/badge.svg?flag=unittests)](https://codecov.io/gh/pydata/xarray)
55
[![Docs](https://readthedocs.org/projects/xray/badge/?version=latest)](https://docs.xarray.dev/)
6-
[![Benchmarked with asv](https://img.shields.io/badge/benchmarked%20by-asv-green.svg?style=flat)](https://pandas.pydata.org/speed/xarray/)
6+
[![Benchmarked with asv](https://img.shields.io/badge/benchmarked%20by-asv-green.svg?style=flat)](https://asv-runner.github.io/asv-collection/xarray/)
77
[![Formatted with black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)
88
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
99
[![Available on pypi](https://img.shields.io/pypi/v/xarray.svg)](https://pypi.python.org/pypi/xarray/)

ci/minimum_versions.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
"pytest",
2727
"pytest-cov",
2828
"pytest-env",
29-
"pytest-xdist",
29+
"pytest-mypy-plugins",
3030
"pytest-timeout",
31+
"pytest-xdist",
3132
"hypothesis",
3233
]
3334

ci/requirements/all-but-dask.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ dependencies:
3030
- pytest
3131
- pytest-cov
3232
- pytest-env
33-
- pytest-xdist
33+
- pytest-mypy-plugins
3434
- pytest-timeout
35+
- pytest-xdist
3536
- rasterio
3637
- scipy
3738
- seaborn

ci/requirements/all-but-numba.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ dependencies:
1212
- cartopy
1313
- cftime
1414
- dask-core
15-
- dask-expr # dask raises a deprecation warning without this, breaking doctests
1615
- distributed
1716
- flox
1817
- fsspec
@@ -44,8 +43,9 @@ dependencies:
4443
- pytest
4544
- pytest-cov
4645
- pytest-env
47-
- pytest-xdist
46+
- pytest-mypy-plugins
4847
- pytest-timeout
48+
- pytest-xdist
4949
- rasterio
5050
- scipy
5151
- seaborn

ci/requirements/bare-minimum.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ dependencies:
99
- pytest
1010
- pytest-cov
1111
- pytest-env
12-
- pytest-xdist
12+
- pytest-mypy-plugins
1313
- pytest-timeout
14+
- pytest-xdist
1415
- numpy=1.24
1516
- packaging=23.1
1617
- pandas=2.1

ci/requirements/doc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ dependencies:
1010
- cfgrib
1111
- kerchunk
1212
- dask-core>=2022.1
13-
- dask-expr
1413
- hypothesis>=6.75.8
1514
- h5netcdf>=0.13
1615
- ipykernel
@@ -31,6 +30,7 @@ dependencies:
3130
- pre-commit
3231
- pyarrow
3332
- pyproj
33+
- rich # for Zarr tree()
3434
- scipy!=1.10.0
3535
- seaborn
3636
- setuptools

ci/requirements/environment-3.13.yml ci/requirements/environment-3.14.yml

+14-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ dependencies:
1010
- cartopy
1111
- cftime
1212
- dask-core
13-
- dask-expr
1413
- distributed
1514
- flox
1615
- fsspec
@@ -30,22 +29,35 @@ dependencies:
3029
- opt_einsum
3130
- packaging
3231
- pandas
32+
- pandas-stubs<=2.2.3.241126 # https://github.com/pydata/xarray/issues/10110
3333
# - pint>=0.22
3434
- pip
3535
- pooch
3636
- pre-commit
37+
- pyarrow # pandas raises a deprecation warning without this, breaking doctests
3738
- pydap
3839
- pytest
3940
- pytest-cov
4041
- pytest-env
41-
- pytest-xdist
42+
- pytest-mypy-plugins
4243
- pytest-timeout
44+
- pytest-xdist
4345
- rasterio
4446
- scipy
4547
- seaborn
4648
# - sparse
4749
- toolz
50+
- types-colorama
51+
- types-docutils
52+
- types-psutil
53+
- types-Pygments
54+
- types-python-dateutil
55+
- types-pytz
56+
- types-PyYAML
57+
- types-setuptools
4858
- typing_extensions
4959
- zarr
5060
- pip:
5161
- jax # no way to get cpu-only jaxlib from conda if gpu is present
62+
- types-defusedxml
63+
- types-pexpect

ci/requirements/environment-windows-3.13.yml ci/requirements/environment-windows-3.14.yml

+15-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ dependencies:
88
- cartopy
99
- cftime
1010
- dask-core
11-
- dask-expr
1211
- distributed
1312
- flox
1413
- fsspec
@@ -26,19 +25,33 @@ dependencies:
2625
- numpy
2726
- packaging
2827
- pandas
28+
- pandas-stubs<=2.2.3.241126 # https://github.com/pydata/xarray/issues/10110
2929
# - pint>=0.22
3030
- pip
3131
- pre-commit
32+
- pyarrow # importing dask.dataframe raises an ImportError without this
3233
- pydap
3334
- pytest
3435
- pytest-cov
3536
- pytest-env
36-
- pytest-xdist
37+
- pytest-mypy-plugins
3738
- pytest-timeout
39+
- pytest-xdist
3840
- rasterio
3941
- scipy
4042
- seaborn
4143
# - sparse
4244
- toolz
45+
- types-colorama
46+
- types-docutils
47+
- types-psutil
48+
- types-Pygments
49+
- types-python-dateutil
50+
- types-pytz
51+
- types-PyYAML
52+
- types-setuptools
4353
- typing_extensions
4454
- zarr
55+
- pip:
56+
- types-defusedxml
57+
- types-pexpect

0 commit comments

Comments
 (0)