Skip to content

Commit

Permalink
fix the detection of backend entrypoints (pydata#5931)
Browse files Browse the repository at this point in the history
  • Loading branch information
keewis authored and snowman2 committed Feb 9, 2022
1 parent 63ed88f commit aa58438
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions ci/requirements/py37-bare-minimum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ dependencies:
- numpy=1.18
- pandas=1.1
- typing_extensions=3.7
- importlib-metadata=2.0
1 change: 1 addition & 0 deletions ci/requirements/py37-min-all-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Deprecations

Bug fixes
~~~~~~~~~
- Fix a regression in the detection of the backend entrypoints (:issue:`5930`, :pull:`5931`)
By `Justus Magin <https://github.com/keewis>`_.

Documentation
~~~~~~~~~~~~~
Expand Down
10 changes: 3 additions & 7 deletions xarray/backends/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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)


Expand Down

0 comments on commit aa58438

Please sign in to comment.