14
14
"""
15
15
import importlib
16
16
17
- from pkg_resources import iter_entry_points
17
+ from importlib . metadata import entry_points
18
18
19
19
from pysteps import io
20
20
from pysteps .decorators import postprocess_import
@@ -49,17 +49,7 @@ def discover_importers():
49
49
The importers found are added to the `pysteps.io.interface_importer_methods`
50
50
dictionary containing the available importers.
51
51
"""
52
-
53
- # The pkg resources needs to be reload to detect new packages installed during
54
- # the execution of the python application. For example, when the plugins are
55
- # installed during the tests
56
- import pkg_resources
57
-
58
- importlib .reload (pkg_resources )
59
-
60
- for entry_point in pkg_resources .iter_entry_points (
61
- group = "pysteps.plugins.importers" , name = None
62
- ):
52
+ for entry_point in entry_points (group = "pysteps.plugins.importers" ):
63
53
_importer = entry_point .load ()
64
54
65
55
importer_function_name = _importer .__name__
@@ -73,14 +63,14 @@ def discover_importers():
73
63
RuntimeWarning (
74
64
f"The importer identifier '{ importer_short_name } ' is already available in"
75
65
"'pysteps.io.interface._importer_methods'.\n "
76
- f"Skipping { entry_point .module_name } :{ '.' . join ( entry_point .attrs ) } "
66
+ f"Skipping { entry_point .module } :{ entry_point .attr } "
77
67
)
78
68
79
69
if hasattr (importers , importer_function_name ):
80
70
RuntimeWarning (
81
71
f"The importer function '{ importer_function_name } ' is already an attribute"
82
72
"of 'pysteps.io.importers`.\n "
83
- f"Skipping { entry_point .module_name } :{ '.' . join ( entry_point .attrs ) } "
73
+ f"Skipping { entry_point .module } :{ entry_point .attr } "
84
74
)
85
75
else :
86
76
setattr (importers , importer_function_name , _importer )
0 commit comments