Skip to content

Commit 0c1ad54

Browse files
dcheriankeewis
andauthored
Pin pint to >=0.22 (#8445)
* unpin pint * More unpins * Try>=0.21 * Bump pint to >=0.22 * Undo windows test skips * Remove nanprod skips * Bump min-deps * use exact pin --------- Co-authored-by: Justus Magin <[email protected]>
1 parent 8e95b60 commit 0c1ad54

9 files changed

+9
-51
lines changed

.binder/environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: xarray-examples
22
channels:
33
- conda-forge
44
dependencies:
5-
- python=3.9
5+
- python=3.10
66
- boto3
77
- bottleneck
88
- cartopy
@@ -25,7 +25,7 @@ dependencies:
2525
- numpy
2626
- packaging
2727
- pandas
28-
- pint
28+
- pint>=0.22
2929
- pip
3030
- pooch
3131
- pydap

ci/requirements/all-but-dask.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dependencies:
2626
- numpy
2727
- packaging
2828
- pandas
29-
- pint<0.21
29+
- pint>=0.22
3030
- pip
3131
- pseudonetcdf
3232
- pydap

ci/requirements/environment-py311.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencies:
2828
- numpy
2929
- packaging
3030
- pandas
31-
- pint<0.21
31+
- pint>=0.22
3232
- pip
3333
- pooch
3434
- pre-commit

ci/requirements/environment-windows-py311.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dependencies:
2525
- numpy
2626
- packaging
2727
- pandas
28-
- pint<0.21
28+
- pint>=0.22
2929
- pip
3030
- pre-commit
3131
- pseudonetcdf

ci/requirements/environment-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dependencies:
2525
- numpy
2626
- packaging
2727
- pandas
28-
- pint<0.21
28+
- pint>=0.22
2929
- pip
3030
- pre-commit
3131
- pseudonetcdf

ci/requirements/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dependencies:
2929
- opt_einsum
3030
- packaging
3131
- pandas
32-
- pint<0.21
32+
- pint>=0.22
3333
- pip
3434
- pooch
3535
- pre-commit

ci/requirements/min-all-deps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ dependencies:
3535
- numpy=1.22
3636
- packaging=21.3
3737
- pandas=1.4
38-
- pint=0.19
38+
- pint=0.22
3939
- pip
4040
- pseudonetcdf=3.2
4141
- pydap=3.3

doc/whats-new.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ New Features
3030
Breaking changes
3131
~~~~~~~~~~~~~~~~
3232

33+
- Bump minimum tested pint version to ``>=0.22``. By `Deepak Cherian <https://github.com/dcherian>`_.
3334

3435
Deprecations
3536
~~~~~~~~~~~~

xarray/tests/test_units.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
import functools
44
import operator
5-
import sys
65

76
import numpy as np
87
import pandas as pd
98
import pytest
10-
from packaging import version
119

1210
import xarray as xr
1311
from xarray.core import dtypes, duck_array_ops
@@ -1513,10 +1511,6 @@ def test_dot_dataarray(dtype):
15131511

15141512

15151513
class TestVariable:
1516-
@pytest.mark.skipif(
1517-
(sys.version_info >= (3, 11)) and sys.platform.startswith("win"),
1518-
reason="fails for some reason on win and 3.11, GH7971",
1519-
)
15201514
@pytest.mark.parametrize(
15211515
"func",
15221516
(
@@ -1539,13 +1533,6 @@ class TestVariable:
15391533
ids=repr,
15401534
)
15411535
def test_aggregation(self, func, dtype):
1542-
if (
1543-
func.name == "prod"
1544-
and dtype.kind == "f"
1545-
and version.parse(pint.__version__) < version.parse("0.19")
1546-
):
1547-
pytest.xfail(reason="nanprod is not by older `pint` versions")
1548-
15491536
array = np.linspace(0, 1, 10).astype(dtype) * (
15501537
unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
15511538
)
@@ -2348,10 +2335,6 @@ def test_repr(self, func, variant, dtype):
23482335
# warnings or errors, but does not check the result
23492336
func(data_array)
23502337

2351-
@pytest.mark.skipif(
2352-
(sys.version_info >= (3, 11)) and sys.platform.startswith("win"),
2353-
reason="fails for some reason on win and 3.11, GH7971",
2354-
)
23552338
@pytest.mark.parametrize(
23562339
"func",
23572340
(
@@ -2404,13 +2387,6 @@ def test_repr(self, func, variant, dtype):
24042387
ids=repr,
24052388
)
24062389
def test_aggregation(self, func, dtype):
2407-
if (
2408-
func.name == "prod"
2409-
and dtype.kind == "f"
2410-
and version.parse(pint.__version__) < version.parse("0.19")
2411-
):
2412-
pytest.xfail(reason="nanprod is not by older `pint` versions")
2413-
24142390
array = np.arange(10).astype(dtype) * (
24152391
unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
24162392
)
@@ -2429,10 +2405,6 @@ def test_aggregation(self, func, dtype):
24292405
assert_units_equal(expected, actual)
24302406
assert_allclose(expected, actual)
24312407

2432-
@pytest.mark.skipif(
2433-
(sys.version_info >= (3, 11)) and sys.platform.startswith("win"),
2434-
reason="fails for some reason on win and 3.11, GH7971",
2435-
)
24362408
@pytest.mark.parametrize(
24372409
"func",
24382410
(
@@ -4085,10 +4057,6 @@ def test_repr(self, func, variant, dtype):
40854057
# warnings or errors, but does not check the result
40864058
func(ds)
40874059

4088-
@pytest.mark.skipif(
4089-
(sys.version_info >= (3, 11)) and sys.platform.startswith("win"),
4090-
reason="fails for some reason on win and 3.11, GH7971",
4091-
)
40924060
@pytest.mark.parametrize(
40934061
"func",
40944062
(
@@ -4110,13 +4078,6 @@ def test_repr(self, func, variant, dtype):
41104078
ids=repr,
41114079
)
41124080
def test_aggregation(self, func, dtype):
4113-
if (
4114-
func.name == "prod"
4115-
and dtype.kind == "f"
4116-
and version.parse(pint.__version__) < version.parse("0.19")
4117-
):
4118-
pytest.xfail(reason="nanprod is not by older `pint` versions")
4119-
41204081
unit_a, unit_b = (
41214082
(unit_registry.Pa, unit_registry.degK)
41224083
if func.name != "cumprod"
@@ -5647,10 +5608,6 @@ def test_merge(self, variant, unit, error, dtype):
56475608

56485609
@requires_dask
56495610
class TestPintWrappingDask:
5650-
@pytest.mark.skipif(
5651-
version.parse(pint.__version__) <= version.parse("0.21"),
5652-
reason="pint didn't support dask properly before 0.21",
5653-
)
56545611
def test_duck_array_ops(self):
56555612
import dask.array
56565613

0 commit comments

Comments
 (0)