Skip to content

Pin pint to >=0.22 #8445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: xarray-examples
channels:
- conda-forge
dependencies:
- python=3.9
- python=3.10
- boto3
- bottleneck
- cartopy
Expand All @@ -25,7 +25,7 @@ dependencies:
- numpy
- packaging
- pandas
- pint
- pint>=0.22
- pip
- pooch
- pydap
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/all-but-dask.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies:
- numpy
- packaging
- pandas
- pint<0.21
- pint>=0.22
- pip
- pseudonetcdf
- pydap
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/environment-py311.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies:
- numpy
- packaging
- pandas
- pint<0.21
- pint>=0.22
- pip
- pooch
- pre-commit
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/environment-windows-py311.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies:
- numpy
- packaging
- pandas
- pint<0.21
- pint>=0.22
- pip
- pre-commit
- pseudonetcdf
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/environment-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies:
- numpy
- packaging
- pandas
- pint<0.21
- pint>=0.22
- pip
- pre-commit
- pseudonetcdf
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies:
- opt_einsum
- packaging
- pandas
- pint<0.21
- pint>=0.22
- pip
- pooch
- pre-commit
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements/min-all-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies:
- numpy=1.22
- packaging=21.3
- pandas=1.4
- pint=0.19
- pint=0.22
- pip
- pseudonetcdf=3.2
- pydap=3.3
Expand Down
1 change: 1 addition & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ New Features
Breaking changes
~~~~~~~~~~~~~~~~

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

Deprecations
~~~~~~~~~~~~
Expand Down
43 changes: 0 additions & 43 deletions xarray/tests/test_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

import functools
import operator
import sys

import numpy as np
import pandas as pd
import pytest
from packaging import version

import xarray as xr
from xarray.core import dtypes, duck_array_ops
Expand Down Expand Up @@ -1513,10 +1511,6 @@ def test_dot_dataarray(dtype):


class TestVariable:
@pytest.mark.skipif(
(sys.version_info >= (3, 11)) and sys.platform.startswith("win"),
reason="fails for some reason on win and 3.11, GH7971",
)
@pytest.mark.parametrize(
"func",
(
Expand All @@ -1539,13 +1533,6 @@ class TestVariable:
ids=repr,
)
def test_aggregation(self, func, dtype):
if (
func.name == "prod"
and dtype.kind == "f"
and version.parse(pint.__version__) < version.parse("0.19")
):
pytest.xfail(reason="nanprod is not by older `pint` versions")

array = np.linspace(0, 1, 10).astype(dtype) * (
unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
)
Expand Down Expand Up @@ -2348,10 +2335,6 @@ def test_repr(self, func, variant, dtype):
# warnings or errors, but does not check the result
func(data_array)

@pytest.mark.skipif(
(sys.version_info >= (3, 11)) and sys.platform.startswith("win"),
reason="fails for some reason on win and 3.11, GH7971",
)
@pytest.mark.parametrize(
"func",
(
Expand Down Expand Up @@ -2404,13 +2387,6 @@ def test_repr(self, func, variant, dtype):
ids=repr,
)
def test_aggregation(self, func, dtype):
if (
func.name == "prod"
and dtype.kind == "f"
and version.parse(pint.__version__) < version.parse("0.19")
):
pytest.xfail(reason="nanprod is not by older `pint` versions")

array = np.arange(10).astype(dtype) * (
unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
)
Expand All @@ -2429,10 +2405,6 @@ def test_aggregation(self, func, dtype):
assert_units_equal(expected, actual)
assert_allclose(expected, actual)

@pytest.mark.skipif(
(sys.version_info >= (3, 11)) and sys.platform.startswith("win"),
reason="fails for some reason on win and 3.11, GH7971",
)
@pytest.mark.parametrize(
"func",
(
Expand Down Expand Up @@ -4085,10 +4057,6 @@ def test_repr(self, func, variant, dtype):
# warnings or errors, but does not check the result
func(ds)

@pytest.mark.skipif(
(sys.version_info >= (3, 11)) and sys.platform.startswith("win"),
reason="fails for some reason on win and 3.11, GH7971",
)
@pytest.mark.parametrize(
"func",
(
Expand All @@ -4110,13 +4078,6 @@ def test_repr(self, func, variant, dtype):
ids=repr,
)
def test_aggregation(self, func, dtype):
if (
func.name == "prod"
and dtype.kind == "f"
and version.parse(pint.__version__) < version.parse("0.19")
):
pytest.xfail(reason="nanprod is not by older `pint` versions")

unit_a, unit_b = (
(unit_registry.Pa, unit_registry.degK)
if func.name != "cumprod"
Expand Down Expand Up @@ -5647,10 +5608,6 @@ def test_merge(self, variant, unit, error, dtype):

@requires_dask
class TestPintWrappingDask:
@pytest.mark.skipif(
version.parse(pint.__version__) <= version.parse("0.21"),
reason="pint didn't support dask properly before 0.21",
)
def test_duck_array_ops(self):
import dask.array

Expand Down