Skip to content

Commit 315fca6

Browse files
authored
Merge branch 'develop' into tc
2 parents 3fc55a9 + 9a4efb4 commit 315fca6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1102
-370
lines changed

.flake8

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/ci_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ jobs:
5151
run: tox -e unit
5252

5353
- name: Coverage
54-
uses: codecov/codecov-action@v4
54+
uses: codecov/codecov-action@v5
5555
with:
5656
token: ${{ secrets.CODECOV_TOKEN }}
57-
file: ./coverage.xml
57+
files: ./coverage.xml
5858
if: matrix.platform == 'ubuntu-latest'

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,48 @@
11
# PEtab changelog
22

3+
## 0.5 series
4+
5+
### 0.5.0
6+
7+
**Fixes**
8+
* Circumvent `SettingWithCopyWarning`
9+
10+
by @m-philipps in https://github.com/PEtab-dev/libpetab-python/pull/306
11+
12+
* If `flatten_timepoint_specific_output_overrides` makes the visualization
13+
table invalid, remove it from `Problem`
14+
15+
by @m-philipps in https://github.com/PEtab-dev/libpetab-python/pull/316
16+
17+
**Features**
18+
19+
* Added `petab.v2.models` by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/302
20+
* Added `petab.v1.priors.priors_to_measurements(...)` for replacing
21+
`objectivePrior*` by observables/measurements
22+
23+
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/309, https://github.com/PEtab-dev/libpetab-python/pull/315, https://github.com/PEtab-dev/libpetab-python/pull/317
24+
25+
* Make model id optional for `PySBModel`
26+
27+
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/318
28+
29+
* Implemented `Model.__repr__`
30+
31+
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/319
32+
33+
**Full Changelog**: https://github.com/PEtab-dev/libpetab-python/compare/v0.4.1...v0.5.0
34+
335
## 0.4 series
436

37+
This series contains many changes related to the new `petab.v2` subpackage. `petab.v2` should not be considered stable; the `petab.v2` API may change rapidly until we release libpetab-python v1.0.0.
38+
39+
### 0.4.1
40+
41+
* Fix: keep previously-optional dependencies optional by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/298
42+
* Add petab.v2.C by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/299
43+
44+
**Full Changelog**: https://github.com/PEtab-dev/libpetab-python/compare/v0.4.0...v0.4.1
45+
546
### 0.4.0
647

748
**Prepare for PEtab v2**

doc/modules.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ API Reference
2020
petab.v1.observables
2121
petab.v1.parameter_mapping
2222
petab.v1.parameters
23+
petab.v1.priors
2324
petab.v1.problem
2425
petab.v1.sampling
2526
petab.v1.sbml
@@ -28,5 +29,6 @@ API Reference
2829
petab.v1.visualize
2930
petab.v1.yaml
3031
petab.v2
32+
petab.v2.C
3133
petab.v2.lint
3234
petab.v2.problem

petab/C.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

petab/__init__.py

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,70 +2,70 @@
22
PEtab global
33
============
44
5-
.. warning::
6-
7-
All functions in here are deprecated. Use the respective functions from
8-
:mod:`petab.v1` instead.
9-
105
Attributes:
116
ENV_NUM_THREADS:
127
Name of environment variable to set number of threads or processes
138
PEtab should use for operations that can be performed in parallel.
149
By default, all operations are performed sequentially.
1510
"""
16-
import functools
17-
import inspect
11+
import importlib
1812
import sys
19-
import warnings
13+
from functools import partial
14+
from pathlib import Path
2015
from warnings import warn
2116

22-
# deprecated imports
23-
from petab.v1 import * # noqa: F403, F401, E402
24-
25-
from .v1.format_version import __format_version__ # noqa: F401, E402
2617

2718
ENV_NUM_THREADS = "PETAB_NUM_THREADS"
28-
29-
30-
def _deprecated_v1(func):
31-
"""Decorator for deprecation warnings for functions."""
32-
33-
@functools.wraps(func)
34-
def new_func(*args, **kwargs):
35-
warnings.warn(
36-
f"petab.{func.__name__} is deprecated, "
37-
f"please use petab.v1.{func.__name__} instead.",
38-
category=DeprecationWarning,
39-
stacklevel=2,
19+
__all__ = ["ENV_NUM_THREADS"]
20+
21+
22+
def __getattr__(name):
23+
if attr := globals().get(name):
24+
return attr
25+
if name == "v1":
26+
return importlib.import_module("petab.v1")
27+
if name != "__path__":
28+
warn(
29+
f"Accessing `petab.{name}` is deprecated and will be removed in "
30+
f"the next major release. Please use `petab.v1.{name}` instead.",
31+
DeprecationWarning,
32+
stacklevel=3,
4033
)
41-
return func(*args, **kwargs)
42-
43-
return new_func
34+
return getattr(importlib.import_module("petab.v1"), name)
4435

4536

46-
def _deprecated_import_v1(module_name: str):
47-
"""Decorator for deprecation warnings for modules."""
48-
warn(
49-
f"The '{module_name}' module is deprecated and will be removed "
50-
f"in the next major release. Please use "
51-
f"'petab.v1.{module_name.removeprefix('petab.')}' "
52-
"instead.",
53-
DeprecationWarning,
54-
stacklevel=2,
55-
)
56-
57-
58-
__all__ = [
59-
x
60-
for x in dir(sys.modules[__name__])
61-
if not x.startswith("_")
62-
and x not in {"sys", "warnings", "functools", "warn", "inspect"}
63-
]
64-
65-
66-
# apply decorator to all functions in the module
67-
for name in __all__:
68-
obj = globals().get(name)
69-
if callable(obj) and inspect.isfunction(obj):
70-
globals()[name] = _deprecated_v1(obj)
71-
del name, obj
37+
def v1getattr(name, module):
38+
if name != "__path__":
39+
warn(
40+
f"Accessing `petab.{name}` is deprecated and will be removed in "
41+
f"the next major release. Please use `petab.v1.{name}` instead.",
42+
DeprecationWarning,
43+
stacklevel=3,
44+
)
45+
try:
46+
return module.__dict__[name]
47+
except KeyError:
48+
raise AttributeError(name) from None
49+
50+
51+
# Create dummy modules for all old modules
52+
v1_root = Path(__file__).resolve().parent / "v1"
53+
v1_objects = [f.relative_to(v1_root) for f in v1_root.rglob("*")]
54+
for v1_object in v1_objects:
55+
if "__pycache__" in str(v1_object):
56+
continue
57+
if v1_object.suffix not in ["", ".py"]:
58+
continue
59+
if not (v1_root / v1_object).exists():
60+
raise ValueError(v1_root / v1_object)
61+
v1_object_parts = [*v1_object.parts[:-1], v1_object.stem]
62+
module_name = ".".join(["petab", *v1_object_parts])
63+
64+
try:
65+
real_module = importlib.import_module(
66+
f"petab.v1.{'.'.join(v1_object_parts)}"
67+
)
68+
real_module.__getattr__ = partial(v1getattr, module=real_module)
69+
sys.modules[module_name] = real_module
70+
except ModuleNotFoundError:
71+
pass

petab/calculate.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

petab/composite_problem.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

petab/conditions.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

petab/core.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)