Skip to content

Remove deprecated petab.* aliases for petab.v1 - #538

Merged
dweindl merged 2 commits into
PEtab-dev:mainfrom
dweindl:remove-petab-v1-shims
Oct 13, 2026
Merged

dweindl merged 2 commits into
PEtab-dev:mainfrom
dweindl:remove-petab-v1-shims

Conversation

@dweindl

@dweindl dweindl commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

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)

dweindl and others added 2 commits October 12, 2026 11:39
Accessing `petab.<name>` or importing `petab.<module>` has been
deprecated in favor of `petab.v1` since 0.4.0. Remove the
`__getattr__` fallback and the `sys.modules` aliases. 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`.

Removing the eager `petab.v1` import exposed a circular import
between `petab.versions` and `petab.v1.yaml`. Fix it by importing
`petab.v1` lazily in `get_major_version`.

Also:
* import `ENV_NUM_THREADS` in `petab.v1.parameter_mapping` from
  `petab` instead of defining it again
* update tests, docstring cross-references, messages, README and the
  visualization notebook to use `petab.v1`
* remove `test_problem_with_sbml_model`, which only differed from
  `test_get_condition_specific_models` by using the deprecated alias
* add a changelog section for the unreleased 0.10.0

Generated with AI assistance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dweindl
dweindl force-pushed the remove-petab-v1-shims branch from 23f0cd5 to 6e45519 Compare October 12, 2026 09:39
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.67%. Comparing base (68f8b69) to head (6e45519).

Files with missing lines Patch % Lines
petab/versions.py 40.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #538      +/-   ##
==========================================
- Coverage   76.77%   76.67%   -0.10%     
==========================================
  Files          67       67              
  Lines        7547     7516      -31     
  Branches     1346     1339       -7     
==========================================
- Hits         5794     5763      -31     
- Misses       1259     1262       +3     
+ Partials      494      491       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dweindl
dweindl marked this pull request as ready for review October 12, 2026 09:59
@dweindl
dweindl requested review from a team and m-philipps as code owners October 12, 2026 09:59

@dilpath dilpath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dweindl
dweindl merged commit 90f7068 into PEtab-dev:main Oct 13, 2026
7 of 13 checks passed
@dweindl
dweindl deleted the remove-petab-v1-shims branch October 13, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants