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