From 196ebc08ba737effffc0c1eb611724b6b741bb9e Mon Sep 17 00:00:00 2001 From: Packit Date: Mon, 17 Nov 2025 17:54:41 +0000 Subject: [PATCH] Update to 2025.11.0 upstream release - Resolves: rhbz#2400395 Commit authored by Packit automation (https://packit.dev/) --- .gitignore | 1 + 0001-Drop-pydap-from-dependencies.patch | 26 +++- ...sure-netcdf4-is-locked-while-closing.patch | 117 ++++++++++++++++++ README.packit | 2 +- locking.patch | 93 -------------- python-xarray.spec | 9 +- sources | 2 +- 7 files changed, 143 insertions(+), 107 deletions(-) create mode 100644 0002-Ensure-netcdf4-is-locked-while-closing.patch delete mode 100644 locking.patch diff --git a/.gitignore b/.gitignore index 1e074a6..9f5edfd 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ /xarray-2025.1.1.tar.gz /xarray-2025.4.0.tar.gz /xarray-2025.9.0.tar.gz +/xarray-2025.11.0.tar.gz diff --git a/0001-Drop-pydap-from-dependencies.patch b/0001-Drop-pydap-from-dependencies.patch index 300542c..07171e3 100644 --- a/0001-Drop-pydap-from-dependencies.patch +++ b/0001-Drop-pydap-from-dependencies.patch @@ -1,21 +1,22 @@ -From 9b688c92bac2f5f0b91371af59f0d9ede076217c Mon Sep 17 00:00:00 2001 +From afa4a2a75f431fd8eb6f46552b6731a6343301e2 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 15 Sep 2025 05:49:16 -0400 -Subject: [PATCH] Drop pydap from dependencies +Subject: [PATCH 1/2] Drop pydap from dependencies We didn't have it since it wasn't available in Python 3.10+, and it's not yet pcakaged. Signed-off-by: Elliott Sales de Andrade --- - pyproject.toml | 1 - - 1 file changed, 1 deletion(-) + pyproject.toml | 1 - + xarray/tests/test_backends.py | 2 +- + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml -index 9da83f80..98c3e13d 100644 +index 31886b8c..fa286383 100644 --- a/pyproject.toml +++ b/pyproject.toml -@@ -39,7 +39,6 @@ complete = ["xarray[accel,etc,io,parallel,viz]"] +@@ -38,7 +38,6 @@ complete = ["xarray[accel,etc,io,parallel,viz]"] io = [ "netCDF4>=1.6.0", "h5netcdf", @@ -23,6 +24,19 @@ index 9da83f80..98c3e13d 100644 "scipy>=1.13", "zarr>=2.18", "fsspec", +diff --git a/xarray/tests/test_backends.py b/xarray/tests/test_backends.py +index 36a1e354..946847d6 100644 +--- a/xarray/tests/test_backends.py ++++ b/xarray/tests/test_backends.py +@@ -7411,7 +7411,7 @@ def test_remote_url_backend_auto_detection() -> None: + "https://example.com/services/DAP2/dataset", # uppercase in path + ] + +- for url in dap_urls: ++ for url in dap_urls[:0]: + engine = guess_engine(url) + assert engine == expected_dap_backend, ( + f"URL {url!r} should select {expected_dap_backend!r} but got {engine!r}" -- 2.50.0 diff --git a/0002-Ensure-netcdf4-is-locked-while-closing.patch b/0002-Ensure-netcdf4-is-locked-while-closing.patch new file mode 100644 index 0000000..9932ec6 --- /dev/null +++ b/0002-Ensure-netcdf4-is-locked-while-closing.patch @@ -0,0 +1,117 @@ +From a7f162c1cbb088f9b863e5e32408f07376442641 Mon Sep 17 00:00:00 2001 +From: David Bold +Date: Tue, 25 Nov 2025 19:58:05 -0500 +Subject: [PATCH 2/2] Ensure netcdf4 is locked while closing + +Signed-off-by: Elliott Sales de Andrade +--- + xarray/backends/file_manager.py | 20 +++++++++++++++----- + xarray/backends/locks.py | 3 +++ + xarray/backends/netCDF4_.py | 8 +++----- + 3 files changed, 21 insertions(+), 10 deletions(-) + +diff --git a/xarray/backends/file_manager.py b/xarray/backends/file_manager.py +index f7cd4675..cf85eaf3 100644 +--- a/xarray/backends/file_manager.py ++++ b/xarray/backends/file_manager.py +@@ -8,7 +8,7 @@ from collections.abc import Callable, Hashable, Iterator, Mapping, MutableMappin + from contextlib import AbstractContextManager, contextmanager + from typing import Any, Generic, Literal, TypeVar, cast + +-from xarray.backends.locks import acquire ++from xarray.backends.locks import NETCDF4_PYTHON_LOCK, acquire + from xarray.backends.lru_cache import LRUCache + from xarray.core import utils + from xarray.core.options import OPTIONS +@@ -89,7 +89,7 @@ class CachingFileManager(FileManager[T_File]): + *args: Any, + mode: Any = _OMIT_MODE, + kwargs: Mapping[str, Any] | None = None, +- lock: Lock | None | Literal[False] = None, ++ lock: Lock | Literal[False] | None = None, + cache: MutableMapping[Any, T_File] | None = None, + manager_id: Hashable | None = None, + ref_counts: dict[Any, int] | None = None, +@@ -448,9 +448,16 @@ def _remove_del_methods(): + class DummyFileManager(FileManager[T_File]): + """FileManager that simply wraps an open file in the FileManager interface.""" + +- def __init__(self, value: T_File, *, close: Callable[[], None] | None = None): ++ def __init__( ++ self, ++ value: T_File, ++ *, ++ close: Callable[[], None] | None = None, ++ lock: Lock | Literal[False] | None = None, ++ ): + if close is None: + close = value.close ++ self._lock = lock + self._value = value + self._close = close + +@@ -464,5 +471,8 @@ class DummyFileManager(FileManager[T_File]): + yield self._value + + def close(self, needs_lock: bool = True) -> None: +- del needs_lock # unused +- self._close() ++ if needs_lock and self._lock: ++ with self._lock: ++ self._close() ++ else: ++ self._close() +diff --git a/xarray/backends/locks.py b/xarray/backends/locks.py +index 78444354..e2db5e93 100644 +--- a/xarray/backends/locks.py ++++ b/xarray/backends/locks.py +@@ -281,3 +281,6 @@ def ensure_lock(lock: Lock | None | Literal[False]) -> Lock: + if lock is None or lock is False: + return DummyLock() + return lock ++ ++ ++NETCDF4_PYTHON_LOCK = combine_locks([NETCDFC_LOCK, HDF5_LOCK]) +diff --git a/xarray/backends/netCDF4_.py b/xarray/backends/netCDF4_.py +index 2c686951..5bc7a741 100644 +--- a/xarray/backends/netCDF4_.py ++++ b/xarray/backends/netCDF4_.py +@@ -30,7 +30,7 @@ from xarray.backends.file_manager import ( + PickleableFileManager, + ) + from xarray.backends.locks import ( +- HDF5_LOCK, ++ NETCDF4_PYTHON_LOCK, + NETCDFC_LOCK, + combine_locks, + ensure_lock, +@@ -67,8 +67,6 @@ if TYPE_CHECKING: + # string used by netCDF4. + _endian_lookup = {"=": "native", ">": "big", "<": "little", "|": "native"} + +-NETCDF4_PYTHON_LOCK = combine_locks([NETCDFC_LOCK, HDF5_LOCK]) +- + + class BaseNetCDF4Array(BackendArray): + __slots__ = ("datastore", "dtype", "shape", "variable_name") +@@ -421,7 +419,7 @@ class NetCDF4DataStore(WritableCFDataStore): + "argument is provided" + ) + root = manager +- manager = DummyFileManager(root) ++ manager = DummyFileManager(root, lock=NETCDF4_PYTHON_LOCK) + + self._manager = manager + self._group = group +@@ -520,7 +518,7 @@ class NetCDF4DataStore(WritableCFDataStore): + ) + else: + manager = CachingFileManager( +- netCDF4.Dataset, filename, mode=mode, kwargs=kwargs ++ netCDF4.Dataset, filename, lock=lock, mode=mode, kwargs=kwargs + ) + return cls(manager, group=group, mode=mode, lock=lock, autoclose=autoclose) + +-- +2.50.0 + diff --git a/README.packit b/README.packit index fb341a1..a901bca 100644 --- a/README.packit +++ b/README.packit @@ -1,3 +1,3 @@ This repository is maintained by packit. https://packit.dev/ -The file was generated using packit 1.11.0.post1.dev7+gfdcdf3a32. +The file was generated using packit 1.12.0.post1.dev18+gc39b0e7d4. diff --git a/locking.patch b/locking.patch deleted file mode 100644 index f961f80..0000000 --- a/locking.patch +++ /dev/null @@ -1,93 +0,0 @@ -diff --git a/xarray/backends/file_manager.py b/xarray/backends/file_manager.py -index 2a6f3691..aa4bf14d 100644 ---- a/xarray/backends/file_manager.py -+++ b/xarray/backends/file_manager.py -@@ -9,7 +9,7 @@ import warnings - from collections.abc import Hashable - from typing import Any - --from xarray.backends.locks import acquire -+from xarray.backends.locks import NETCDF4_PYTHON_LOCK, acquire - from xarray.backends.lru_cache import LRUCache - from xarray.core import utils - from xarray.core.options import OPTIONS -@@ -339,9 +339,16 @@ class _HashedSequence(list): - class DummyFileManager(FileManager): - """FileManager that simply wraps an open file in the FileManager interface.""" - -- def __init__(self, value, *, close=None): -+ def __init__( -+ self, -+ value, -+ *, -+ close=None, -+ lock: Lock | None | Literal[False] = None, -+ ): - if close is None: - close = value.close -+ self._lock = lock - self._value = value - self._close = close - -@@ -355,5 +362,8 @@ class DummyFileManager(FileManager): - yield self._value - - def close(self, needs_lock=True): -- del needs_lock # ignored -- self._close() -+ if needs_lock and self._lock: -+ with self._lock: -+ self._close() -+ else: -+ self._close() -diff --git a/xarray/backends/locks.py b/xarray/backends/locks.py -index 82d3e0b7..a857d904 100644 ---- a/xarray/backends/locks.py -+++ b/xarray/backends/locks.py -@@ -281,3 +281,6 @@ def ensure_lock(lock): - if lock is None or lock is False: - return DummyLock() - return lock -+ -+ -+NETCDF4_PYTHON_LOCK = combine_locks([NETCDFC_LOCK, HDF5_LOCK]) -diff --git a/xarray/backends/netCDF4_.py b/xarray/backends/netCDF4_.py -index d6a37b06..3561966c 100644 ---- a/xarray/backends/netCDF4_.py -+++ b/xarray/backends/netCDF4_.py -@@ -23,7 +23,7 @@ from xarray.backends.common import ( - ) - from xarray.backends.file_manager import CachingFileManager, DummyFileManager - from xarray.backends.locks import ( -- HDF5_LOCK, -+ NETCDF4_PYTHON_LOCK, - NETCDFC_LOCK, - combine_locks, - ensure_lock, -@@ -58,8 +58,6 @@ if TYPE_CHECKING: - # string used by netCDF4. - _endian_lookup = {"=": "native", ">": "big", "<": "little", "|": "native"} - --NETCDF4_PYTHON_LOCK = combine_locks([NETCDFC_LOCK, HDF5_LOCK]) -- - - class BaseNetCDF4Array(BackendArray): - __slots__ = ("datastore", "dtype", "shape", "variable_name") -@@ -390,7 +388,7 @@ class NetCDF4DataStore(WritableCFDataStore): - "argument is provided" - ) - root = manager -- manager = DummyFileManager(root) -+ manager = DummyFileManager(root, lock=NETCDF4_PYTHON_LOCK) - - self._manager = manager - self._group = group -@@ -463,7 +461,7 @@ class NetCDF4DataStore(WritableCFDataStore): - if auto_complex is not None: - kwargs["auto_complex"] = auto_complex - manager = CachingFileManager( -- netCDF4.Dataset, filename, mode=mode, kwargs=kwargs -+ netCDF4.Dataset, filename, lock=lock, mode=mode, kwargs=kwargs - ) - return cls(manager, group=group, mode=mode, lock=lock, autoclose=autoclose) - diff --git a/python-xarray.spec b/python-xarray.spec index 0dd96a4..b37d30b 100644 --- a/python-xarray.spec +++ b/python-xarray.spec @@ -1,7 +1,7 @@ %global srcname xarray Name: python-%{srcname} -Version: 2025.9.0 +Version: 2025.11.0 Release: %autorelease Summary: N-D labeled arrays and datasets in Python @@ -10,12 +10,9 @@ URL: https://github.com/pydata/xarray Source: %pypi_source %{srcname} # Fedora specific. Patch: 0001-Drop-pydap-from-dependencies.patch - # RHBZ#2395128 -# rebase of https://github.com/pydata/xarray/pull/10788.patch -# PR#10788 has merge conflicts -Patch: locking.patch - +# https://github.com/pydata/xarray/pull/10788 +Patch: 0002-Ensure-netcdf4-is-locked-while-closing.patch BuildArch: noarch diff --git a/sources b/sources index 7222736..9b216e1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (xarray-2025.9.0.tar.gz) = 0cc572de58c59badb383d20292cf092500192e1723c12423f7d4c87e110feb08156cff71c136e45dd35eb70941a55e44a88774b698d09ecd083a882a207317e1 +SHA512 (xarray-2025.11.0.tar.gz) = 8dc1a7dc058d945c19c829f95f1ea132fe4f52471659428d0a4e109f54dbae9c4da10647303b6870548f0b0013469936265206638559096bcc6fe73a0f1f7c1c