Skip to content

chore(petab): retire the BnglModel adapter and register_bngl() now that petab 0.9.0 ships the loader, and drop Python 3.11 (#591) - #682

Merged
wshlavacek merged 1 commit into
mainfrom
chore/retire-register-bngl-591
Sep 10, 2026
Merged

chore(petab): retire the BnglModel adapter and register_bngl() now that petab 0.9.0 ships the loader, and drop Python 3.11 (#591)#682
wshlavacek merged 1 commit into
mainfrom
chore/retire-register-bngl-591

Conversation

@wshlavacek

Copy link
Copy Markdown
Collaborator

Fixes #591.

The gate cleared on 2026-09-07: petab 0.9.0 is the first PyPI release whose known_model_types includes bngl, carrying the native BnglModel loader PyBNF contributed upstream in PEtab-dev/libpetab-python#508. On any 0.9.0 installation register_bngl() already saw bngl registered and returned without rebinding, so the local adapter was dead at runtime and only the tests that constructed it directly still exercised it.

Removed

  • pybnf/petab/bngl_model.py: the BnglModel adapter, register_bngl(), and its _locate_bng2 helper, plus the automodule entry.
  • The pytest-native-bngl CI leg that installed upstream libpetab-python main to reach the native loader ahead of a release, and the setup action's petab-spec input it used.
  • Every register_bngl() call in the tests, tutorial lessons 12 and 13, the lint-clinic fixture generator, and the three real-world make_petab.py scripts. The docs section on the loader now shows the plain petab call.

Python 3.11 dropped

The petab and tests extras now floor at petab >= 0.9 (the action installs the same pin; test_packaging_metadata cross-checks the two). petab 0.9.0 requires Python 3.12, so the project floor moves with it: requires-python, the classifier, ruff's target-version, the CI matrix, the packaging test, and the install/cluster docs and batch scripts that named 3.11.

Kept, and one gap this exposes

_bngl.py stays: it is the reader the importer and exporter use, and its drift note now points at the shipped upstream module rather than a branch.

_bngl_expr.py (the #666 parameter-expression evaluator) also stays, with a caveat worth knowing. The adapter was its only consumer, and petab's native BnglModel does not evaluate an expression-valued parameter: get_parameter_value raises NotImplementedError and get_free_parameter_ids_with_values skips it. That is the pre-#666 behaviour on the petab-side validation path. It is not a regression of this PR, since the no-op already routed 0.9.0 users to the native class, but the #666 fix never reached the path it was written for. #681 tracks the upstream port; the evaluator stays as its staging copy and its unit tests now drive it directly.

Tests

  • TestNativeBnglModel replaces the adapter unit tests: it pins the ABC seam the exporter relies on (parameter ids and values, entity namespace, formula symbols, state variables) against petab's class, and asserts the native loader is present, taking over the retired CI leg's assert step.
  • The corpus validity test passes an explicit model_id: petab derives one from the file stem and requires a PEtab identifier, which the hyphenated corpus filenames are not.
  • tests/_bngl_differential.py carries its own _locate_bng2; the tutorial tests import BnglModel / _locate_bng2 from petab where they still need them.

Locally under petab 0.9.0 on Python 3.12, every test_petab*.py file, the PEtab tutorial tests, the lint clinic, the priors lesson, new-era validation, and the packaging metadata tests pass (730 passed). The pinned ruff gate and the -W docs build are clean. ADR-0026 gains an addendum and the CHANGELOG records the floor change and the removal.

…at petab 0.9.0 ships the loader, and drop Python 3.11 (#591)

petab 0.9.0 (2026-09-07) is the first PyPI release whose known_model_types
includes bngl: the native BnglModel loader PyBNF contributed upstream in
PEtab-dev/libpetab-python#508 shipped. That is the trigger #591 was gated on.
On any 0.9.0 installation register_bngl() already saw bngl registered and
returned without rebinding, so the local adapter was dead at runtime and only
the tests that constructed it directly still exercised it.

Removed: pybnf/petab/bngl_model.py (the BnglModel adapter, register_bngl(),
and its _locate_bng2 helper); the pytest-native-bngl CI leg that installed
upstream libpetab-python main to reach the native loader ahead of a release;
the setup-pybnf action's petab-spec input that leg used; the automodule entry
for the removed module; and every register_bngl() call in the tests, the
tutorial lessons (12, 13), the lint-clinic fixture generator, and the three
real-world make_petab.py scripts.

The petab and tests extras now floor at petab >= 0.9, and the action installs
the same pin, which test_packaging_metadata already cross-checks. petab 0.9.0
requires Python >= 3.12, so the project floor moves to 3.12: requires-python,
the classifier, ruff's target-version, the CI matrix, the packaging test, and
the install/cluster docs and batch scripts that named 3.11.

Kept: pybnf/petab/_bngl.py, the reader the importer and exporter use (its
drift note now points at the shipped upstream module), and
pybnf/petab/_bngl_expr.py, the parameter-expression evaluator from #666. The
adapter was the evaluator's only consumer, and petab's native BnglModel does
not evaluate an expression-valued parameter (get_parameter_value raises
NotImplementedError, get_free_parameter_ids_with_values skips it). That is
not a regression of this change, since the no-op already routed 0.9.0 users
to the native class, but it is the next upstream port; the evaluator stays as
its staging copy and its unit tests now drive the evaluator directly.

Tests: the adapter's unit tests are replaced by TestNativeBnglModel, which
pins the ABC seam the exporter relies on (parameter ids and values, entity
namespace, formula symbols, state variables) against petab's class and
asserts the native loader is present, taking over the retired CI leg's assert
step. The corpus validity test passes an explicit model_id because petab
derives one from the file stem and requires a PEtab identifier, which the
hyphenated corpus filenames are not. tests/_bngl_differential.py carries its
own _locate_bng2. The tutorial tests import BnglModel and _locate_bng2 from
petab where they still need them.

Locally, under petab 0.9.0 on Python 3.12: every test_petab*.py, the PEtab
tutorial tests, the lint clinic, the priors lesson, new-era validation, and
the packaging metadata tests pass (730 passed). The pinned ruff gate and the
-W docs build are clean. ADR-0026 gains an addendum; CHANGELOG records the
floor change and the removal.
@wshlavacek
wshlavacek merged commit 80620cb into main Sep 10, 2026
8 checks passed
@wshlavacek
wshlavacek deleted the chore/retire-register-bngl-591 branch September 10, 2026 17:40
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.

Retire register_bngl() + petab-spec CI machinery once a PyPI petab after 0.8.2 ships native BNGL

1 participant