From 845546637e100284c3cc748e9c54b9e660facf44 Mon Sep 17 00:00:00 2001 From: Keewis Date: Wed, 3 Nov 2021 11:28:55 +0100 Subject: [PATCH 1/4] fix the entrypoint detection --- xarray/backends/plugins.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/xarray/backends/plugins.py b/xarray/backends/plugins.py index b71ca7be55c..bcaee498b90 100644 --- a/xarray/backends/plugins.py +++ b/xarray/backends/plugins.py @@ -6,10 +6,10 @@ from .common import BACKEND_ENTRYPOINTS, BackendEntrypoint try: - from importlib.metadata import Distribution + from importlib.metadata import entry_points except ImportError: # if the fallback library is missing, we are doomed. - from importlib_metadata import Distribution # type: ignore[no-redef] + from importlib_metadata import entry_points # type: ignore[no-redef] STANDARD_BACKENDS_ORDER = ["netcdf4", "h5netcdf", "scipy"] @@ -99,11 +99,7 @@ def build_engines(entrypoints): @functools.lru_cache(maxsize=1) def list_engines(): - entrypoints = ( - entry_point - for entry_point in Distribution.from_name("xarray").entry_points - if entry_point.module == "xarray.backends" - ) + entrypoints = entry_points().get("xarray.backends", ()) return build_engines(entrypoints) From 82df80d312244deb7764996f31f6a5955def6ec6 Mon Sep 17 00:00:00 2001 From: Keewis Date: Wed, 3 Nov 2021 11:35:41 +0100 Subject: [PATCH 2/4] update whats-new.rst --- doc/whats-new.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index a971ef2ae9b..6a4054470b3 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -31,6 +31,8 @@ Deprecations Bug fixes ~~~~~~~~~ +- Fix a regression in the detection of the backend entrypoints (:issue:`5930`, :pull:``) + By `Justus Magin `_. Internal Changes ~~~~~~~~~~~~~~~~ From 9f44f9395cfc963def72c3abb3079d25a598df15 Mon Sep 17 00:00:00 2001 From: Keewis Date: Wed, 3 Nov 2021 11:58:14 +0100 Subject: [PATCH 3/4] add the pr number --- doc/whats-new.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 6a4054470b3..d590515b11b 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -31,7 +31,7 @@ Deprecations Bug fixes ~~~~~~~~~ -- Fix a regression in the detection of the backend entrypoints (:issue:`5930`, :pull:``) +- Fix a regression in the detection of the backend entrypoints (:issue:`5930`, :pull:`5931`) By `Justus Magin `_. Internal Changes From fb6113cb0b26260401424e2a9d52bcabe382f624 Mon Sep 17 00:00:00 2001 From: Keewis Date: Wed, 3 Nov 2021 12:02:46 +0100 Subject: [PATCH 4/4] add importlib-metadata to the min deps environments --- ci/requirements/py37-bare-minimum.yml | 1 + ci/requirements/py37-min-all-deps.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/ci/requirements/py37-bare-minimum.yml b/ci/requirements/py37-bare-minimum.yml index f9148d6dfd0..620b5057d50 100644 --- a/ci/requirements/py37-bare-minimum.yml +++ b/ci/requirements/py37-bare-minimum.yml @@ -13,3 +13,4 @@ dependencies: - numpy=1.18 - pandas=1.1 - typing_extensions=3.7 + - importlib-metadata=2.0 diff --git a/ci/requirements/py37-min-all-deps.yml b/ci/requirements/py37-min-all-deps.yml index 2d5a0f4e8d9..e62987dd31a 100644 --- a/ci/requirements/py37-min-all-deps.yml +++ b/ci/requirements/py37-min-all-deps.yml @@ -24,6 +24,7 @@ dependencies: - hdf5=1.10 - hypothesis - iris=2.4 + - importlib-metadata=2.0 - lxml=4.6 # Optional dep of pydap - matplotlib-base=3.3 - nc-time-axis=1.2