Skip to content

Commit 1ce7b22

Browse files
authored
Deprecate Model.petab_yaml properly (#147)
1 parent e95c2f6 commit 1ce7b22

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

petab_select/model.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,19 @@ class Model(ModelBase):
410410
:attr:`model_subspace_petab_yaml`.
411411
"""
412412

413+
@model_validator(mode="before")
414+
@classmethod
415+
def _deprecated_petab_yaml(cls, data: Any) -> Any:
416+
if isinstance(data, dict) and "petab_yaml" in data:
417+
data[MODEL_SUBSPACE_PETAB_YAML] = data.pop("petab_yaml")
418+
warnings.warn(
419+
"Change the `petab_yaml` field of your model data "
420+
"to `model_subspace_petab_yaml.",
421+
DeprecationWarning,
422+
stacklevel=2,
423+
)
424+
return data
425+
413426
@model_validator(mode="after")
414427
def _fix_petab_problem(self: Model) -> Model:
415428
"""Fix a missing PEtab problem by loading it from disk."""

0 commit comments

Comments
 (0)