Skip to content

Commit ad6b5bc

Browse files
committed
Merge branch 'main' into groupby-aggs-using-numpy-groupies
* main: [pre-commit.ci] pre-commit autoupdate (pydata#6115) Make CI pass by limiting dask version (pydata#6111) Fix mypy precommit (pydata#6110) [pre-commit.ci] pre-commit autoupdate (pydata#6088) Add type definitions in prep for pydata#6086 (pydata#6090) Replace distutils.version with packaging.version (pydata#6096) Attempt datetime coding using cftime when pandas fails (pydata#6049) fix tests for h5netcdf v0.12 (pydata#6097) disable pytest-xdist (to check CI failure) (pydata#6077) cftime: 'gregorian' -> 'standard' [test-upstream] (pydata#6082) Add release note skeleton for 0.21 (pydata#6061)
2 parents 1875fd2 + 5d30f96 commit ad6b5bc

32 files changed

+203
-99
lines changed

.github/workflows/ci-additional.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
python -c "import xarray"
9797
- name: Run tests
9898
run: |
99-
python -m pytest -n 4 \
99+
python -m pytest \
100100
--cov=xarray \
101101
--cov-report=xml \
102102
$PYTEST_EXTRA_FLAGS

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
run: |
8888
python -c "import xarray"
8989
- name: Run tests
90-
run: python -m pytest -n 4
90+
run: python -m pytest
9191
--cov=xarray
9292
--cov-report=xml
9393
--junitxml=pytest.xml

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://pre-commit.com/
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.0.1
4+
rev: v4.1.0
55
hooks:
66
- id: trailing-whitespace
77
- id: end-of-file-fixer
@@ -32,7 +32,7 @@ repos:
3232
# - id: velin
3333
# args: ["--write", "--compact"]
3434
- repo: https://github.com/pre-commit/mirrors-mypy
35-
rev: v0.910-1
35+
rev: v0.930
3636
hooks:
3737
- id: mypy
3838
# `properies` & `asv_bench` are copied from setup.cfg.

ci/install-upstream-wheels.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ conda uninstall -y --force \
1515
bottleneck \
1616
sparse \
1717
flox \
18+
h5netcdf \
1819
xarray
1920
# to limit the runtime of Upstream CI
2021
python -m pip install pytest-timeout
@@ -45,4 +46,5 @@ python -m pip install \
4546
git+https://github.com/pydata/sparse \
4647
git+https://github.com/intake/filesystem_spec \
4748
git+https://github.com/SciTools/nc-time-axis \
48-
git+https://github.com/dcherian/flox
49+
git+https://github.com/dcherian/flox \
50+
git+https://github.com/h5netcdf/h5netcdf

ci/requirements/environment-windows.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ dependencies:
88
# - cdms2 # Not available on Windows
99
# - cfgrib # Causes Python interpreter crash on Windows: https://github.com/pydata/xarray/pull/3340
1010
- cftime
11-
- dask-core
11+
- dask-core != 2021.12.0 # https://github.com/pydata/xarray/pull/6111, can remove on next release
1212
- distributed
1313
- fsspec!=2021.7.0
1414
- h5netcdf
1515
- h5py
1616
- hdf5
1717
- hypothesis
1818
- iris
19-
- lxml # Optional dep of pydap
19+
- lxml # Optional dep of pydap
2020
- matplotlib-base
2121
- nc-time-axis
2222
- netcdf4
@@ -43,5 +43,5 @@ dependencies:
4343
- typing_extensions
4444
- zarr
4545
- pip:
46-
- numbagg
47-
- git+https://github.com/dcherian/flox.git
46+
- numbagg
47+
- git+https://github.com/dcherian/flox.git

ci/requirements/environment.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ dependencies:
1010
- cdms2
1111
- cfgrib
1212
- cftime
13-
- dask-core
13+
- dask-core != 2021.12.0 # https://github.com/pydata/xarray/pull/6111, can remove on next release
1414
- distributed
1515
- fsspec!=2021.7.0
1616
- h5netcdf
1717
- h5py
1818
- hdf5
1919
- hypothesis
2020
- iris
21-
- lxml # Optional dep of pydap
21+
- lxml # Optional dep of pydap
2222
- matplotlib-base
2323
- nc-time-axis
2424
- netcdf4
@@ -47,5 +47,5 @@ dependencies:
4747
- typing_extensions
4848
- zarr
4949
- pip:
50-
- numbagg
51-
- git+https://github.com/dcherian/flox.git
50+
- numbagg
51+
- git+https://github.com/dcherian/flox.git

doc/whats-new.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,37 @@ What's New
1414
1515
np.random.seed(123456)
1616
17+
.. _whats-new.0.X.Y+1:
18+
19+
v0.21.0 (unreleased)
20+
---------------------
21+
22+
New Features
23+
~~~~~~~~~~~~
24+
25+
26+
Breaking changes
27+
~~~~~~~~~~~~~~~~
28+
29+
30+
Deprecations
31+
~~~~~~~~~~~~
32+
33+
34+
Bug fixes
35+
~~~~~~~~~
36+
37+
38+
Documentation
39+
~~~~~~~~~~~~~
40+
41+
42+
Internal Changes
43+
~~~~~~~~~~~~~~~~
44+
45+
- Replace ``distutils.version`` with ``packaging.version`` (:issue:`6092`).
46+
By `Mathias Hauser <https://github.com/mathause>`_.
47+
1748

1849
.. _whats-new.0.20.2:
1950

@@ -51,6 +82,8 @@ Bug fixes
5182
By `Sebastian Weigand <https://github.com/s-weigand>`_.
5283
- Fix a regression in the removal of duplicate backend entrypoints (:issue:`5944`, :pull:`5959`)
5384
By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_.
85+
- Fix an issue that datasets from being saved when time variables with units that ``cftime`` can parse but pandas can not were present (:pull:`6049`).
86+
By `Tim Heap <https://github.com/mx-moth>`_.
5487

5588
Documentation
5689
~~~~~~~~~~~~~

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ ignore_missing_imports = True
200200
ignore_missing_imports = True
201201
[mypy-h5py.*]
202202
ignore_missing_imports = True
203+
[mypy-importlib_metadata.*]
204+
ignore_missing_imports = True
203205
[mypy-iris.*]
204206
ignore_missing_imports = True
205207
[mypy-matplotlib.*]

xarray/backends/h5netcdf_.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import functools
22
import io
33
import os
4-
from distutils.version import LooseVersion
54

65
import numpy as np
6+
from packaging.version import Version
77

88
from ..core import indexing
99
from ..core.utils import (
@@ -156,16 +156,16 @@ def open(
156156

157157
kwargs = {"invalid_netcdf": invalid_netcdf}
158158
if phony_dims is not None:
159-
if LooseVersion(h5netcdf.__version__) >= LooseVersion("0.8.0"):
159+
if Version(h5netcdf.__version__) >= Version("0.8.0"):
160160
kwargs["phony_dims"] = phony_dims
161161
else:
162162
raise ValueError(
163163
"h5netcdf backend keyword argument 'phony_dims' needs "
164164
"h5netcdf >= 0.8.0."
165165
)
166-
if LooseVersion(h5netcdf.__version__) >= LooseVersion(
167-
"0.10.0"
168-
) and LooseVersion(h5netcdf.core.h5py.__version__) >= LooseVersion("3.0.0"):
166+
if Version(h5netcdf.__version__) >= Version("0.10.0") and Version(
167+
h5netcdf.core.h5py.__version__
168+
) >= Version("3.0.0"):
169169
kwargs["decode_vlen_strings"] = decode_vlen_strings
170170

171171
if lock is None:

xarray/coding/cftimeindex.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242
import re
4343
import warnings
4444
from datetime import timedelta
45-
from distutils.version import LooseVersion
4645
from typing import Tuple, Type
4746

4847
import numpy as np
4948
import pandas as pd
49+
from packaging.version import Version
5050

5151
from xarray.core.utils import is_scalar
5252

@@ -193,15 +193,13 @@ def f(self, min_cftime_version=min_cftime_version):
193193
if cftime is None:
194194
raise ModuleNotFoundError("No module named 'cftime'")
195195

196-
version = cftime.__version__
197-
198-
if LooseVersion(version) >= LooseVersion(min_cftime_version):
196+
if Version(cftime.__version__) >= Version(min_cftime_version):
199197
return get_date_field(self._data, name)
200198
else:
201199
raise ImportError(
202-
"The {!r} accessor requires a minimum "
203-
"version of cftime of {}. Found an "
204-
"installed version of {}.".format(name, min_cftime_version, version)
200+
f"The {name:!r} accessor requires a minimum "
201+
f"version of cftime of {min_cftime_version}. Found an "
202+
f"installed version of {cftime.__version__}."
205203
)
206204

207205
f.__name__ = name

0 commit comments

Comments
 (0)