diff --git a/segno/__init__.py b/segno/__init__.py index ef3e7a6a..e9e2b4ac 100644 --- a/segno/__init__.py +++ b/segno/__init__.py @@ -950,10 +950,13 @@ def __getattr__(self, name): of invoking the function depends on the plugin. """ if name.startswith('to_'): - from pkg_resources import iter_entry_points + try: + from importlib import metadata + except ImportError: # Python < 3.8 + import importlib_metadata as metadata from functools import partial - for ep in iter_entry_points(group='segno.plugin.converter', - name=name[3:]): + for ep in metadata.entry_points(group='segno.plugin.converter', + name=name[3:]): plugin = ep.load() return partial(plugin, self) raise AttributeError('{0} object has no attribute {1}' diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 30465481..fb0e43a6 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -8,7 +8,6 @@ """\ Tests plugin loading. """ -import os import pytest import segno