Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/xarray/files/, dev-python/xarray/
Date: Sat, 03 Jul 2021 16:06:50
Message-Id: 1625328398.f231076548125ab4780412b9c58514b251b79fcb.mgorny@gentoo
1 commit: f231076548125ab4780412b9c58514b251b79fcb
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jul 3 11:12:50 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 3 16:06:38 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f2310765
7
8 dev-python/xarray: Backport pandas & dask compatibility fixes
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 .../xarray/files/xarray-0.18.2-backports.patch | 116 +++++++++++++++++++++
13 ...array-0.18.2.ebuild => xarray-0.18.2-r1.ebuild} | 4 +
14 2 files changed, 120 insertions(+)
15
16 diff --git a/dev-python/xarray/files/xarray-0.18.2-backports.patch b/dev-python/xarray/files/xarray-0.18.2-backports.patch
17 new file mode 100644
18 index 00000000000..be30702e67f
19 --- /dev/null
20 +++ b/dev-python/xarray/files/xarray-0.18.2-backports.patch
21 @@ -0,0 +1,116 @@
22 +From ca72d56c213a1c47e54b12ee559f412e60fbf9b1 Mon Sep 17 00:00:00 2001
23 +From: Spencer Clark <spencerkclark@×××××.com>
24 +Date: Sat, 22 May 2021 20:13:19 -0400
25 +Subject: [PATCH] Make `kind` argument in `CFTimeIndex._maybe_cast_slice_bound`
26 + optional (#5359)
27 +
28 +* [test-upstream] Make kind argument in CFTimeIndex._maybe_cast_slice_bound optional
29 +
30 +* Update doc/whats-new.rst
31 +
32 +Co-authored-by: keewis <keewis@××××××××××××××××××××.com>
33 +
34 +Co-authored-by: keewis <keewis@××××××××××××××××××××.com>
35 +---
36 + doc/whats-new.rst | 4 ++++
37 + xarray/coding/cftimeindex.py | 9 +++++++--
38 + 2 files changed, 11 insertions(+), 2 deletions(-)
39 +
40 +diff --git a/xarray/coding/cftimeindex.py b/xarray/coding/cftimeindex.py
41 +index f0de5565..783fe8d0 100644
42 +--- a/xarray/coding/cftimeindex.py
43 ++++ b/xarray/coding/cftimeindex.py
44 +@@ -465,9 +465,14 @@ class CFTimeIndex(pd.Index):
45 + else:
46 + return pd.Index.get_loc(self, key, method=method, tolerance=tolerance)
47 +
48 +- def _maybe_cast_slice_bound(self, label, side, kind):
49 ++ def _maybe_cast_slice_bound(self, label, side, kind=None):
50 + """Adapted from
51 +- pandas.tseries.index.DatetimeIndex._maybe_cast_slice_bound"""
52 ++ pandas.tseries.index.DatetimeIndex._maybe_cast_slice_bound
53 ++
54 ++ Note that we have never used the kind argument in CFTimeIndex and it is
55 ++ deprecated as of pandas version 1.3.0. It exists only for compatibility
56 ++ reasons. We can remove it when our minimum version of pandas is 1.3.0.
57 ++ """
58 + if not isinstance(label, str):
59 + return label
60 +
61 +--
62 +2.32.0
63 +
64 +From 34dc57717c82a86455a9e5abb0a47df782266c7e Mon Sep 17 00:00:00 2001
65 +From: Mathias Hauser <mathause@××××××××××××××××××××.com>
66 +Date: Mon, 7 Jun 2021 23:05:24 +0200
67 +Subject: [PATCH] fix dask meta and output_dtypes error (#5449)
68 +
69 +---
70 + xarray/tests/test_computation.py | 5 ++++-
71 + 1 file changed, 4 insertions(+), 1 deletion(-)
72 +
73 +diff --git a/xarray/tests/test_computation.py b/xarray/tests/test_computation.py
74 +index b7ae1ca9..09bed724 100644
75 +--- a/xarray/tests/test_computation.py
76 ++++ b/xarray/tests/test_computation.py
77 +@@ -1306,7 +1306,10 @@ def test_vectorize_dask_dtype_without_output_dtypes(data_array):
78 + assert expected.dtype == actual.dtype
79 +
80 +
81 +-@×××××××××××.xfail(LooseVersion(dask.__version__) < "2.3", reason="dask GH5274")
82 ++@×××××××××××.skipif(
83 ++ LooseVersion(dask.__version__) > "2021.06",
84 ++ reason="dask/dask#7669: can no longer pass output_dtypes and meta",
85 ++)
86 + @requires_dask
87 + def test_vectorize_dask_dtype_meta():
88 + # meta dtype takes precedence
89 +--
90 +2.32.0
91 +
92 +From 5a14d7d398be7e0efc6d5c8920dc8886212c3b2a Mon Sep 17 00:00:00 2001
93 +From: Spencer Clark <spencerkclark@×××××.com>
94 +Date: Sat, 12 Jun 2021 08:58:42 -0400
95 +Subject: [PATCH] Explicitly state datetime units in array constructors in
96 + `test_datetime_mean` (#5463)
97 +
98 +---
99 + xarray/tests/test_duck_array_ops.py | 10 ++++------
100 + 1 file changed, 4 insertions(+), 6 deletions(-)
101 +
102 +diff --git a/xarray/tests/test_duck_array_ops.py b/xarray/tests/test_duck_array_ops.py
103 +index 0eb00725..6d49e209 100644
104 +--- a/xarray/tests/test_duck_array_ops.py
105 ++++ b/xarray/tests/test_duck_array_ops.py
106 +@@ -285,15 +285,15 @@ def assert_dask_array(da, dask):
107 + def test_datetime_mean(dask):
108 + # Note: only testing numpy, as dask is broken upstream
109 + da = DataArray(
110 +- np.array(["2010-01-01", "NaT", "2010-01-03", "NaT", "NaT"], dtype="M8"),
111 ++ np.array(["2010-01-01", "NaT", "2010-01-03", "NaT", "NaT"], dtype="M8[ns]"),
112 + dims=["time"],
113 + )
114 + if dask:
115 + # Trigger use case where a chunk is full of NaT
116 + da = da.chunk({"time": 3})
117 +
118 +- expect = DataArray(np.array("2010-01-02", dtype="M8"))
119 +- expect_nat = DataArray(np.array("NaT", dtype="M8"))
120 ++ expect = DataArray(np.array("2010-01-02", dtype="M8[ns]"))
121 ++ expect_nat = DataArray(np.array("NaT", dtype="M8[ns]"))
122 +
123 + actual = da.mean()
124 + if dask:
125 +@@ -889,8 +889,6 @@ def test_push_dask():
126 + # some chunks of size-1 with NaN
127 + with raise_if_dask_computes():
128 + actual = push(
129 +- dask.array.from_array(array, chunks=(1, 2, 3, 2, 2, 1, 1)),
130 +- axis=0,
131 +- n=None,
132 ++ dask.array.from_array(array, chunks=(1, 2, 3, 2, 2, 1, 1)), axis=0, n=None
133 + )
134 + np.testing.assert_equal(actual, expected)
135 +--
136 +2.32.0
137 +
138
139 diff --git a/dev-python/xarray/xarray-0.18.2.ebuild b/dev-python/xarray/xarray-0.18.2-r1.ebuild
140 similarity index 95%
141 rename from dev-python/xarray/xarray-0.18.2.ebuild
142 rename to dev-python/xarray/xarray-0.18.2-r1.ebuild
143 index bedc8b3da11..573e03b4e44 100644
144 --- a/dev-python/xarray/xarray-0.18.2.ebuild
145 +++ b/dev-python/xarray/xarray-0.18.2-r1.ebuild
146 @@ -32,6 +32,10 @@ BDEPEND="
147
148 distutils_enable_tests pytest
149
150 +PATCHES=(
151 + "${FILESDIR}"/${P}-backports.patch
152 +)
153 +
154 python_test() {
155 local deselect=(
156 # warning-targeted tests are fragile and not important to end users