diff --git a/pygal/__init__.py b/pygal/__init__.py index 3a1bc582..f118cb98 100644 --- a/pygal/__init__.py +++ b/pygal/__init__.py @@ -29,7 +29,7 @@ import traceback import warnings -from importlib_metadata import entry_points +from importlib.metadata import entry_points from pygal import maps from pygal.config import Config @@ -62,7 +62,10 @@ from pygal.graph.map import BaseMap -for entry in entry_points(group="pygal.maps"): +for entry in entry_points(): + # TODO: when targeting Python 3.10+, this can use `entry_points(group=...)`. + if entry.group != "pygal.maps": + continue try: module = entry.load() except Exception: diff --git a/pygal/test/test_maps.py b/pygal/test/test_maps.py index ed069586..cee8bf2d 100644 --- a/pygal/test/test_maps.py +++ b/pygal/test/test_maps.py @@ -18,10 +18,13 @@ # along with pygal. If not, see . """Map plugins tests are imported here""" -from importlib_metadata import entry_points +from importlib.metadata import entry_points # Load plugins tests -for entry in entry_points(group="pygal.test.test_maps"): +for entry in entry_points(): + # TODO: when targeting Python 3.10+, this can use `entry_points(group=...)`. + if entry.group != "pygal.test.test_maps": + continue module = entry.load() for k, v in module.__dict__.items(): if k.startswith('test_'):