From 68a87599ce7696e588d9c04521d98d142742a6f2 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 13 Jan 2025 22:32:01 -0500 Subject: [PATCH] Update to latest version (#2328431) - Remove doc subpackage; it's been disabled for a while --- .gitignore | 1 + ...amples-using-unpackaged-dependencies.patch | 33 ------ ...on-t-print-out-conda-pip-environment.patch | 39 ------- 9945.patch | 102 ++++++++++++++++++ python-xarray.spec | 72 ++----------- sources | 3 +- 6 files changed, 113 insertions(+), 137 deletions(-) delete mode 100644 0001-DOC-Skip-examples-using-unpackaged-dependencies.patch delete mode 100644 0002-DOC-Don-t-print-out-conda-pip-environment.patch create mode 100644 9945.patch diff --git a/.gitignore b/.gitignore index 91e8e1a..547192a 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ /xarray-2024.6.0.tar.gz /xarray-2024.7.0.tar.gz /xarray-2024.10.0.tar.gz +/xarray-2025.1.1.tar.gz diff --git a/0001-DOC-Skip-examples-using-unpackaged-dependencies.patch b/0001-DOC-Skip-examples-using-unpackaged-dependencies.patch deleted file mode 100644 index 306befb..0000000 --- a/0001-DOC-Skip-examples-using-unpackaged-dependencies.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0265d68ed1f82dd36aa78ce77fdaa69f802f66b0 Mon Sep 17 00:00:00 2001 -From: Elliott Sales de Andrade -Date: Fri, 15 Mar 2019 22:48:25 -0400 -Subject: [PATCH 1/2] DOC: Skip examples using unpackaged dependencies. - -Signed-off-by: Elliott Sales de Andrade ---- - doc/user-guide/io.rst | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/doc/user-guide/io.rst b/doc/user-guide/io.rst -index f4b3e5ab..3db742ee 100644 ---- a/doc/user-guide/io.rst -+++ b/doc/user-guide/io.rst -@@ -1077,6 +1077,7 @@ installed, xarray can convert a ``DataArray`` into a ``Cube`` using - :py:meth:`DataArray.to_iris`: - - .. ipython:: python -+ :verbatim: - - da = xr.DataArray( - np.random.rand(4, 5), -@@ -1091,6 +1092,7 @@ Conversely, we can create a new ``DataArray`` object from a ``Cube`` using - :py:meth:`DataArray.from_iris`: - - .. ipython:: python -+ :verbatim: - - da_cube = xr.DataArray.from_iris(cube) - da_cube --- -2.47.0 - diff --git a/0002-DOC-Don-t-print-out-conda-pip-environment.patch b/0002-DOC-Don-t-print-out-conda-pip-environment.patch deleted file mode 100644 index 4175c0a..0000000 --- a/0002-DOC-Don-t-print-out-conda-pip-environment.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 11411fe78441e6e390c53ebe5d85311f4f1d04cc Mon Sep 17 00:00:00 2001 -From: Elliott Sales de Andrade -Date: Sat, 16 Mar 2019 02:59:15 -0400 -Subject: [PATCH 2/2] DOC: Don't print out conda/pip environment. - -Signed-off-by: Elliott Sales de Andrade ---- - doc/conf.py | 8 -------- - 1 file changed, 8 deletions(-) - -diff --git a/doc/conf.py b/doc/conf.py -index d4328dbf..23928bd1 100644 ---- a/doc/conf.py -+++ b/doc/conf.py -@@ -16,7 +16,6 @@ import datetime - import inspect - import os - import pathlib --import subprocess - import sys - from contextlib import suppress - from textwrap import dedent, indent -@@ -35,13 +34,6 @@ allowed_failures = set() - print("python exec:", sys.executable) - print("sys.path:", sys.path) - --if "CONDA_DEFAULT_ENV" in os.environ or "conda" in sys.executable: -- print("conda environment:") -- subprocess.run([os.environ.get("CONDA_EXE", "conda"), "list"]) --else: -- print("pip environment:") -- subprocess.run([sys.executable, "-m", "pip", "list"]) -- - print(f"xarray: {xarray.__version__}, {xarray.__file__}") - - with suppress(ImportError): --- -2.47.0 - diff --git a/9945.patch b/9945.patch new file mode 100644 index 0000000..ebbf613 --- /dev/null +++ b/9945.patch @@ -0,0 +1,102 @@ +From da4aa1f2f116089c75adee5954bcc9ab755bcb89 Mon Sep 17 00:00:00 2001 +From: Deepak Cherian +Date: Mon, 13 Jan 2025 08:00:50 -0600 +Subject: [PATCH 1/2] Remove outdated quantile test. + +dask now auto-rechunks for quantile. + +Closes #9860 +--- + xarray/tests/test_groupby.py | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +diff --git a/xarray/tests/test_groupby.py b/xarray/tests/test_groupby.py +index e4383dd58a9..2349ff0adfd 100644 +--- a/xarray/tests/test_groupby.py ++++ b/xarray/tests/test_groupby.py +@@ -284,7 +284,6 @@ def test_da_groupby_empty() -> None: + + @requires_dask + def test_dask_da_groupby_quantile() -> None: +- # Only works when the grouped reduction can run blockwise + # Scalar quantile + expected = xr.DataArray( + data=[2, 5], coords={"x": [1, 2], "quantile": 0.5}, dims="x" +@@ -292,8 +291,6 @@ def test_dask_da_groupby_quantile() -> None: + array = xr.DataArray( + data=[1, 2, 3, 4, 5, 6], coords={"x": [1, 1, 1, 2, 2, 2]}, dims="x" + ) +- with pytest.raises(ValueError): +- array.chunk(x=1).groupby("x").quantile(0.5) + + # will work blockwise with flox + actual = array.chunk(x=3).groupby("x").quantile(0.5) +@@ -327,7 +324,8 @@ def test_dask_da_groupby_median() -> None: + assert_identical(expected, actual) + + +-def test_da_groupby_quantile() -> None: ++@pytest.mark.parametrize("use_flox", [True, False]) ++def test_da_groupby_quantile(use_flox) -> None: + array = xr.DataArray( + data=[1, 2, 3, 4, 5, 6], coords={"x": [1, 1, 1, 2, 2, 2]}, dims="x" + ) +@@ -336,8 +334,10 @@ def test_da_groupby_quantile() -> None: + expected = xr.DataArray( + data=[2, 5], coords={"x": [1, 2], "quantile": 0.5}, dims="x" + ) +- actual = array.groupby("x").quantile(0.5) +- assert_identical(expected, actual) ++ ++ with xr.set_options(use_flox=use_flox): ++ actual = array.groupby("x").quantile(0.5) ++ assert_identical(expected, actual) + + # Vector quantile + expected = xr.DataArray( +@@ -345,7 +345,8 @@ def test_da_groupby_quantile() -> None: + coords={"x": [1, 2], "quantile": [0, 1]}, + dims=("x", "quantile"), + ) +- actual = array.groupby("x").quantile([0, 1]) ++ with xr.set_options(use_flox=use_flox): ++ actual = array.groupby("x").quantile([0, 1]) + assert_identical(expected, actual) + + array = xr.DataArray( +@@ -356,7 +357,8 @@ def test_da_groupby_quantile() -> None: + e = [np.nan, 5] if skipna is False else [2.5, 5] + + expected = xr.DataArray(data=e, coords={"x": [1, 2], "quantile": 0.5}, dims="x") +- actual = array.groupby("x").quantile(0.5, skipna=skipna) ++ with xr.set_options(use_flox=use_flox): ++ actual = array.groupby("x").quantile(0.5, skipna=skipna) + assert_identical(expected, actual) + + # Multiple dimensions + +From 3d6e76a29a328489b0867a89fce1c157605c5f5d Mon Sep 17 00:00:00 2001 +From: Deepak Cherian +Date: Mon, 13 Jan 2025 10:28:29 -0600 +Subject: [PATCH 2/2] Apply suggestions from code review + +Co-authored-by: Michael Niklas +--- + xarray/tests/test_groupby.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/xarray/tests/test_groupby.py b/xarray/tests/test_groupby.py +index 2349ff0adfd..7dd6cdb622d 100644 +--- a/xarray/tests/test_groupby.py ++++ b/xarray/tests/test_groupby.py +@@ -324,8 +324,8 @@ def test_dask_da_groupby_median() -> None: + assert_identical(expected, actual) + + +-@pytest.mark.parametrize("use_flox", [True, False]) +-def test_da_groupby_quantile(use_flox) -> None: ++@pytest.mark.parametrize("use_flox", [pytest.param(True, marks=requires_flox), False]) ++def test_da_groupby_quantile(use_flox: bool) -> None: + array = xr.DataArray( + data=[1, 2, 3, 4, 5, 6], coords={"x": [1, 1, 1, 2, 2, 2]}, dims="x" + ) diff --git a/python-xarray.spec b/python-xarray.spec index 581e013..bfa2384 100644 --- a/python-xarray.spec +++ b/python-xarray.spec @@ -1,36 +1,28 @@ %global srcname xarray -%global data_commit 7d8290e0be9d2a8f4b4381641f20a97db6eaea3d - -%bcond docs 0 Name: python-%{srcname} -Version: 2024.10.0 +Version: 2025.1.1 Release: %autorelease Summary: N-D labeled arrays and datasets in Python License: Apache-2.0 URL: https://github.com/pydata/xarray -Source0: %pypi_source %{srcname} -# Data for examples only. -Source1: https://github.com/pydata/xarray-data/archive/%{data_commit}/xarray-data-%{data_commit}.tar.gz -# All Fedora specific. -Patch: 0001-DOC-Skip-examples-using-unpackaged-dependencies.patch -Patch: 0002-DOC-Don-t-print-out-conda-pip-environment.patch +Source: %pypi_source %{srcname} + +# Fix test_dask_da_groupby_quantile. +Patch: https://github.com/pydata/xarray/pull/9945.patch BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3dist(bottleneck) -BuildRequires: python3dist(cftime) >= 1.2 BuildRequires: python3dist(dask[array]) >= 2023.9 BuildRequires: python3dist(dask[dataframe]) >= 2023.9 -BuildRequires: python3dist(netcdf4) >= 1.5 BuildRequires: python3dist(pint) >= 0.16 BuildRequires: python3dist(pytest) >= 2.7.1 BuildRequires: python3dist(pytest-xdist) BuildRequires: python3dist(rasterio) >= 1.1 BuildRequires: python3dist(seaborn) >= 0.11 -BuildRequires: python3dist(zarr) >= 2.16 %global _description %{expand: \ Xarray (formerly xray) is an open source project and Python package that @@ -50,62 +42,24 @@ data model, and integrates tightly with dask for parallel computing.} %description %{_description} - %package -n python3-%{srcname} Summary: %{summary} - %description -n python3-%{srcname} %{_description} - -%if %{with docs} -%package -n python-%{srcname}-doc -Summary: xarray documentation - -BuildRequires: python3dist(cartopy) -BuildRequires: natural-earth-map-data-110m -BuildRequires: natural-earth-map-data-10m -BuildRequires: python3-ipython-sphinx -BuildRequires: python3dist(jupyter-client) -BuildRequires: python3dist(matplotlib) >= 3.3 -BuildRequires: python3dist(sphinx) -BuildRequires: python3dist(sphinx-gallery) -BuildRequires: python3dist(sphinx-rtd-theme) - -%description -n python-%{srcname}-doc -Documentation for xarray -%endif - +%pyproject_extras_subpkg -n python3-%{srcname} io %prep %autosetup -n %{srcname}-%{version} -p1 -%if %{with docs} -# Provide example datasets for building docs. -tar xf %SOURCE1 --transform='s~^\(%{srcname}-data-%{data_commit}/\)~\1.xarray_tutorial_data/~' -%endif - - %generate_buildrequires -%pyproject_buildrequires -r - +%pyproject_buildrequires -x io %build %pyproject_wheel -%if %{with docs} -# generate html docs -pushd doc -PYTHONPATH=${PWD}/.. HOME=${PWD}/../%{srcname}-data-%{data_commit} sphinx-build -b html . _build/html -# remove the sphinx-build leftovers -rm -rf _build/html/.{doctrees,buildinfo} -popd -%endif - - %install %pyproject_install -%pyproject_save_files %{srcname} - +%pyproject_save_files -l %{srcname} %check rm -rf xarray @@ -119,17 +73,9 @@ pytest_args=( %{pytest} -ra "${pytest_args[@]}" --pyargs xarray - %files -n python3-%{srcname} -f %{pyproject_files} -%license LICENSE licenses/DASK_LICENSE licenses/NUMPY_LICENSE licenses/PANDAS_LICENSE licenses/PYTHON_LICENSE licenses/SEABORN_LICENSE +%license licenses/* %doc README.md -%if %{with docs} -%files -n python-%{srcname}-doc -%doc doc/_build/html -%license LICENSE licenses/DASK_LICENSE licenses/NUMPY_LICENSE licenses/PANDAS_LICENSE licenses/PYTHON_LICENSE licenses/SEABORN_LICENSE -%endif - - %changelog %autochangelog diff --git a/sources b/sources index cc182b0..a602475 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ -SHA512 (xarray-2024.10.0.tar.gz) = 3a17548cdc3d3b6123c81c124a47b1e538b223e8955593064b37dcc23f61b7cbaf62df57d74a0b8f8cd55f21bfd1a8c69622cb328d08e4212cf0c16d464416dd -SHA512 (xarray-data-7d8290e0be9d2a8f4b4381641f20a97db6eaea3d.tar.gz) = 3734ad5649b9ba23e8fe52ac1fc34694dcb3c761a1817e520726a83d31e725e2448aa0109ad7ad385572ae7d6a285bf1407d104f87227127a6a51d73b797a952 +SHA512 (xarray-2025.1.1.tar.gz) = a0cde2c8e38887878bcde25fd3ea6ee436b522ca73f52359d2c8ac1993447472d7cd5e5d4b11016ec48d1b86dba08e9207caf00b2b43ab896c777395e51f7943