Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation decorators for functions #4757

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies = [
"posthog",
"pyyaml",
"platformdirs",
"deprecation"
]

[project.urls]
Expand Down
13 changes: 13 additions & 0 deletions src/pybamm/expression_tree/symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import pybamm
from pybamm.util import import_optional_dependency
from pybamm.expression_tree.printing.print_name import prettify_print_name
from deprecation import deprecated

if TYPE_CHECKING: # pragma: no cover
import casadi
Expand Down Expand Up @@ -356,6 +357,12 @@ def domain(self, domain):
)

@property
@deprecated(
deprecated_in="25.1.0",
removed_in="26.0.0",
current_version=pybamm.__version__,
details="Use `symbol.domains` instead.",
)
def auxiliary_domains(self):
"""Returns auxiliary domains."""
raise NotImplementedError(
Expand Down Expand Up @@ -994,6 +1001,12 @@ def create_copy(
children = self._children_for_copying(new_children)
return self.__class__(self.name, children, domains=self.domains)

@deprecated(
deprecated_in="25.1.0",
removed_in="26.0.0",
current_version=pybamm.__version__,
details="Use `create_copy` instead.",
)
def new_copy(
self,
new_children: list[Symbol] | None = None,
Expand Down
14 changes: 13 additions & 1 deletion src/pybamm/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from datetime import timedelta
import pybamm.telemetry
from pybamm.util import import_optional_dependency

from deprecation import deprecated
from pybamm.expression_tree.operations.serialise import Serialise


Expand Down Expand Up @@ -171,6 +171,12 @@ def _set_random_seed(self):
% (2**32)
)

@deprecated(
deprecated_in="25.1.0",
removed_in="26.0.0",
current_version=pybamm.__version__,
details="pybamm.simulation.set_up_and_parameterise_experiment is deprecated and not meant to be accessed by users.",
)
def set_up_and_parameterise_experiment(self, solve_kwargs=None):
msg = "pybamm.simulation.set_up_and_parameterise_experiment is deprecated and not meant to be accessed by users."
warnings.warn(msg, DeprecationWarning, stacklevel=2)
RohitP2005 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -254,6 +260,12 @@ def _set_up_and_parameterise_experiment(self, solve_kwargs=None):
parameterised_model
)

@deprecated(
deprecated_in="25.1.0",
removed_in="26.0.0",
current_version=pybamm.__version__,
details="pybamm.set_parameters is deprecated and not meant to be accessed by users.",
)
def set_parameters(self):
msg = (
"pybamm.set_parameters is deprecated and not meant to be accessed by users."
RohitP2005 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading