diff --git a/requirements.txt b/requirements.txt index 0178c41ff..601b73559 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,6 @@ numpy>=1.15.0 requests>=2.13.0,<3.0.0 plac<1.0.0,>=0.9.6 pathlib==1.0.1; python_version < "3.4" -importlib_metadata>=0.23; python_version < "3.8" # Optional dependencies jsonschema>=2.6.0,<3.1.0 # Development dependencies diff --git a/setup.cfg b/setup.cfg index c626f9566..bcb85eef3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -50,7 +50,6 @@ install_requires = wasabi>=0.2.0,<1.1.0 srsly>=0.1.0,<1.1.0 pathlib==1.0.1; python_version < "3.4" - importlib_metadata>=0.23; python_version < "3.8" [options.extras_require] lookups = diff --git a/spacy/compat.py b/spacy/compat.py index 3a19e9423..16b400ad7 100644 --- a/spacy/compat.py +++ b/spacy/compat.py @@ -35,11 +35,6 @@ try: except ImportError: cupy = None -try: # Python 3.8 - import importlib.metadata as importlib_metadata -except ImportError: - import importlib_metadata # noqa: F401 - try: from thinc.neural.optimizers import Optimizer # noqa: F401 except ImportError: diff --git a/spacy/util.py b/spacy/util.py index 103fe35b5..06d9b460d 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -27,7 +27,7 @@ except ImportError: from .symbols import ORTH from .compat import cupy, CudaStream, path2str, basestring_, unicode_ -from .compat import import_file, importlib_metadata +from .compat import import_file from .errors import Errors, Warnings, deprecation_warning @@ -283,8 +283,7 @@ def get_entry_points(key): RETURNS (dict): Entry points, keyed by name. """ result = {} - eps = importlib_metadata.entry_points() - for entry_point in eps.get(key, []): + for entry_point in pkg_resources.iter_entry_points(key): result[entry_point.name] = entry_point.load() return result @@ -298,8 +297,7 @@ def get_entry_point(key, value, default=None): default: Optional default value to return. RETURNS: The loaded entry point or None. """ - eps = importlib_metadata.entry_points() - for entry_point in eps.get(key, []): + for entry_point in pkg_resources.iter_entry_points(key): if entry_point.name == value: return entry_point.load() return default