From 384b8721a7d9ed71ea9ef9c1d60d610649e16084 Mon Sep 17 00:00:00 2001 From: James Bourbeau Date: Fri, 18 Jun 2021 23:26:02 -0500 Subject: [PATCH] Update entrypoint selection --- fsspec/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fsspec/__init__.py b/fsspec/__init__.py index dfceac3c7..30944cab0 100644 --- a/fsspec/__init__.py +++ b/fsspec/__init__.py @@ -42,11 +42,15 @@ if entry_points is not None: try: - entry_points = entry_points() + eps = entry_points() except TypeError: pass # importlib-metadata < 0.8 else: - for spec in entry_points.get("fsspec.specs", []): + if hasattr(eps, "select"): # Python 3.10+ / importlib_metadata >= 3.9.0 + specs = eps.select(group="fsspec.specs") + else: + specs = eps.get("fsspec.specs", []) + for spec in specs: err_msg = f"Unable to load filesystem from {spec}" register_implementation( spec.name, spec.value.replace(":", "."), errtxt=err_msg