Skip to content

Commit

Permalink
added deprecation warning in the entry point
Browse files Browse the repository at this point in the history
  • Loading branch information
santacodes committed Oct 4, 2024
1 parent 22c8822 commit 74879b4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/pybamm/entry_points.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import warnings
import importlib.metadata
import textwrap
from collections.abc import Mapping
Expand Down Expand Up @@ -96,6 +97,16 @@ def __getattribute__(self, name):
try:
return super().__getattribute__(name)
except AttributeError as error:
# For backwards compatibility, parameter sets that used to be defined in
# this file now return the name as a string, which will load the same
# parameter set as before when passed to `ParameterValues`
if name in self:
msg = (
f"Parameter sets should be called directly by their name ({name}), "
f"instead of via pybamm.parameter_sets (pybamm.parameter_sets.{name})."
)
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return name
raise error


Expand Down

0 comments on commit 74879b4

Please sign in to comment.