Skip to content

Commit

Permalink
Merge pull request #2475 from awadell1/doc-fix
Browse files Browse the repository at this point in the history
Rename to entrypoint to `pybamm_parameter_sets`
  • Loading branch information
valentinsulzer authored Nov 18, 2022
2 parents 4f0d148 + 74bf311 commit 8478e9a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

## Breaking changes

- Renamed entry point for parameter sets to `pybamm_parameter_sets` ([#2475](https://github.com/pybamm-team/PyBaMM/pull/2475))
- Removed code for generating `ModelingToolkit` problems ([#2432](https://github.com/pybamm-team/PyBaMM/pull/2432))
- Removed `FirstOrder` and `Composite` lead-acid models, and some submodels specific to those models ([#2431](https://github.com/pybamm-team/PyBaMM/pull/2431))

Expand All @@ -25,7 +26,7 @@

## Features

- Third-party parameter sets can be added by registering entry points to `pybamm_parameter_set` ([#2396](https://github.com/pybamm-team/PyBaMM/pull/2396))
- Third-party parameter sets can be added by registering entry points to ~~`pybamm_parameter_set`~~`pybamm_parameter_sets` ([#2396](https://github.com/pybamm-team/PyBaMM/pull/2396), changed in [#2475](https://github.com/pybamm-team/PyBaMM/pull/2475))
- Added three-dimensional interpolation ([#2380](https://github.com/pybamm-team/PyBaMM/pull/2380))

## Bug fixes
Expand Down
4 changes: 2 additions & 2 deletions pybamm/parameters/parameter_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ParameterSets(Mapping):
def __init__(self):
# Dict of entry points for parameter sets, lazily load entry points as
self.__all_parameter_sets = dict()
for entry_point in pkg_resources.iter_entry_points("pybamm_parameter_set"):
for entry_point in pkg_resources.iter_entry_points("pybamm_parameter_sets"):
self.__all_parameter_sets[entry_point.name] = entry_point

def __new__(cls):
Expand All @@ -49,7 +49,7 @@ def __getitem__(self, key) -> dict:
return self.__load_entry_point__(key)()

def __load_entry_point__(self, key) -> callable:
"""Check that ``key`` is a registered ``pybamm_parameter_set``,
"""Check that ``key`` is a registered ``pybamm_parameter_sets``,
and return the entry point for the parameter set, loading it needed.
"""
if key not in self.__all_parameter_sets:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def compile_KLU():
"pybamm_install_odes = pybamm.install_odes:main",
"pybamm_install_jax = pybamm.util:install_jax",
],
"pybamm_parameter_set": [
"pybamm_parameter_sets": [
"Sulzer2019 = pybamm.input.parameters.lead_acid.Sulzer2019:get_parameter_values", # noqa: E501
"Ai2020 = pybamm.input.parameters.lithium_ion.Ai2020:get_parameter_values", # noqa: E501
"Chen2020 = pybamm.input.parameters.lithium_ion.Chen2020:get_parameter_values", # noqa: E501
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_parameters/test_parameter_sets_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def test_name_interface(self):

def test_all_registered(self):
"""Check that all parameter sets have been registered with the
``pybamm_parameter_set`` entry point"""
``pybamm_parameter_sets`` entry point"""
known_entry_points = set(
ep.name for ep in pkg_resources.iter_entry_points("pybamm_parameter_set")
ep.name for ep in pkg_resources.iter_entry_points("pybamm_parameter_sets")
)
self.assertEqual(set(pybamm.parameter_sets.keys()), known_entry_points)
self.assertEqual(len(known_entry_points), len(pybamm.parameter_sets))
Expand Down

0 comments on commit 8478e9a

Please sign in to comment.