Repository navigation
Use petab.v1 imports instead of deprecated top-level petab aliases - #330
Merged
Merged
Conversation
libpetab-python will remove the deprecated top-level `petab.*` aliases, leaving only `petab.v1`, `petab.v2`, `petab.ENV_NUM_THREADS` and `petab.__version__`. `from petab.yaml import load_yaml` in `overview.py` would then break `import benchmark_models_petab`. Switch to `petab.v1` there and in the problem-specific generator scripts and README snippets under `problems/*/resources/` (Smith_BMCSystBiol2013, Blasi_CellSystems2016, Isensee_JCB2018). In Smith_BMCSystBiol2013's `generate_petab.py`, `import petab.v1.models` would rebind `petab` to the top-level package and shadow the `petab.v1` alias, so use `from petab.v1.models import sbml_model` instead. `petab.v1` exists since petab 0.4.0, so the `petab>=0.4.0` requirement is unchanged. Drafted with AI assistance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dweindl
added a commit
to PEtab-dev/libpetab-python
that referenced
this pull request
Oct 13, 2026
Accessing `petab.<name>` or importing `petab.<module>` has been deprecated in favor of `petab.v1` since 0.4.0 (July 2024). This removes the `__getattr__` fallback and the `sys.modules` aliases from `petab/__init__.py`. The only top-level names left are `petab.v1`, `petab.v2`, `petab.ENV_NUM_THREADS` and `petab.__version__`. Everything else now raises `AttributeError` or `ModuleNotFoundError`. As a side effect, `import petab` no longer imports `petab.v1`. **This is a breaking change** for code that still uses the old paths. The fix is to replace `import petab` with `import petab.v1 as petab` and `from petab.<module> import ...` with `from petab.v1.<module> import ...`. Other changes: * Fixed a circular import between `petab.versions` and `petab.v1.yaml` that the old eager `petab.v1` import had been hiding. * `petab.v1.parameter_mapping` now imports `ENV_NUM_THREADS` from `petab` instead of defining it again. * Updated tests, docstring cross-references, messages, the README and the visualization notebook to use `petab.v1`. * Removed `test_problem_with_sbml_model`, which only differed from `test_get_condition_specific_models` by using the deprecated alias. * Added a changelog section for the unreleased 0.10.0. Requires Benchmarking-Initiative/Benchmark-Models-PEtab#330: CI installs `benchmark_models_petab` from master, which still imports `petab.yaml`. `tests/v1/test_priors.py` fails until that PR is merged. 🤖 Drafted with AI assistance ([Claude Code](https://claude.com/claude-code)) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
libpetab-python will remove the deprecated top-level
petab.*aliases; onlypetab.v1,petab.v2,petab.ENV_NUM_THREADSandpetab.__version__will remain.from petab.yaml import load_yamlinoverview.pywould then breakimport benchmark_models_petab.This switches that import to
petab.v1, and does the same for the generator scripts / README snippets underproblems/*/resources/(Smith_BMCSystBiol2013, Blasi_CellSystems2016, Isensee_JCB2018). In Smith'sgenerate_petab.py,import petab.v1.modelswould rebindpetabto the top-level package and shadow theimport petab.v1 as petabalias, so it usesfrom petab.v1.models import sbml_modelinstead.The
petab>=0.4.0requirement is unchanged (petab.v1exists since 0.4.0). The rest of the package already usespetab.v1.Relates to #328 (no overlapping files; merges cleanly).
🤖 Generated with Claude Code