diff --git a/datalad_metalad/extract.py b/datalad_metalad/extract.py index 263b455f..8d42a8e8 100644 --- a/datalad_metalad/extract.py +++ b/datalad_metalad/extract.py @@ -490,7 +490,7 @@ def get_extractor_class(extractor_name: str) -> Union[ Type[FileMetadataExtractor]]: """ Get an extractor from its name """ - if sys.version_info < (3, 10): + if sys.version_info < (3, 9): from importlib_metadata import entry_points else: from importlib.metadata import entry_points @@ -502,21 +502,19 @@ def get_extractor_class(extractor_name: str) -> Union[ # from datalad core. entry_point_list = [ entry_point - for entry_point in entry_points( - group="datalad.metadata.extractors", - name=extractor_name, - ) - if entry_point.dist.name != "datalad" + for entry_point in entry_points() + if entry_point.group == "datalad.metadata.extractors" + and entry_point.name == extractor_name + and entry_point.dist.name != "datalad" ] if not entry_point_list: entry_point_list = [ entry_point - for entry_point in entry_points( - group="datalad.metadata.extractors", - name=extractor_name, - ) - if entry_point.dist.name == "datalad" + for entry_point in entry_points() + if entry_point.group == "datalad.metadata.extractors" + and entry_point.name == extractor_name + and entry_point.dist.name == "datalad" ] if not entry_point_list: diff --git a/datalad_metalad/extractors/tests/test_base.py b/datalad_metalad/extractors/tests/test_base.py index 451f91bf..a2174b92 100644 --- a/datalad_metalad/extractors/tests/test_base.py +++ b/datalad_metalad/extractors/tests/test_base.py @@ -11,7 +11,7 @@ import sys import pytest -if sys.version_info < (3, 10): +if sys.version_info < (3, 9): from importlib_metadata import entry_points else: from importlib.metadata import entry_points diff --git a/datalad_metalad/filter.py b/datalad_metalad/filter.py index a6ddc35c..6494f84b 100644 --- a/datalad_metalad/filter.py +++ b/datalad_metalad/filter.py @@ -286,7 +286,7 @@ def run_filter(filter_name: str, def get_filter_class(filter_name: str) -> Type[MetadataFilterBase]: """ Get a filter class from its name""" - if sys.version_info < (3, 10): + if sys.version_info < (3, 9): from importlib_metadata import entry_points else: from importlib.metadata import entry_points diff --git a/datalad_metalad/utils.py b/datalad_metalad/utils.py index 9a9b6e36..cc2f9e9d 100644 --- a/datalad_metalad/utils.py +++ b/datalad_metalad/utils.py @@ -4,7 +4,7 @@ from pathlib import Path from typing import Dict, List, Union -if sys.version_info < (3, 10): +if sys.version_info < (3, 9): from importlib_resources import files else: from importlib.resources import files diff --git a/requirements.txt b/requirements.txt index 01bcfbb7..69ace2e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ datalad>=0.18 -sphinx>=1.7.8 -sphinx-rtd-theme +datalad-metadata-model>=0.3.10 +importlib-resources pytest pyyaml -datalad-metadata-model>=0.3.10 +sphinx>=1.7.8 +sphinx-rtd-theme