File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 9
9
10
10
## Bug fixes
11
11
12
+ - Switched from ` pkg_resources ` to ` importlib_metadata ` for handling entry points ([ #2500 ] ( https://github.com/pybamm-team/PyBaMM/pull/2500 ) )
12
13
- Fixed some bugs related to processing ` FunctionParameter ` to ` Interpolant ` ([ #2494 ] ( https://github.com/pybamm-team/PyBaMM/pull/2494 ) )
13
14
14
15
## Optimizations
Original file line number Diff line number Diff line change 1
1
import warnings
2
- import pkg_resources
2
+ import importlib_metadata
3
3
import textwrap
4
4
from collections .abc import Mapping
5
5
@@ -36,7 +36,9 @@ class ParameterSets(Mapping):
36
36
def __init__ (self ):
37
37
# Dict of entry points for parameter sets, lazily load entry points as
38
38
self .__all_parameter_sets = dict ()
39
- for entry_point in pkg_resources .iter_entry_points ("pybamm_parameter_sets" ):
39
+ for entry_point in importlib_metadata .entry_points (
40
+ group = "pybamm_parameter_sets"
41
+ ):
40
42
self .__all_parameter_sets [entry_point .name ] = entry_point
41
43
42
44
def __new__ (cls ):
@@ -55,7 +57,7 @@ def __load_entry_point__(self, key) -> callable:
55
57
if key not in self .__all_parameter_sets :
56
58
raise KeyError (f"Unknown parameter set: { key } " )
57
59
ps = self .__all_parameter_sets [key ]
58
- if isinstance (ps , pkg_resources .EntryPoint ):
60
+ if isinstance (ps , importlib_metadata .EntryPoint ):
59
61
ps = self .__all_parameter_sets [key ] = ps .load ()
60
62
return ps
61
63
You can’t perform that action at this time.
0 commit comments