Conversation
* Fall back to BaseModel when custom model base class can't be imported Restore the pre-#5389 contract where `Serialise.load_custom_model` always produced a plain `BaseModel` when the recorded subclass isn't available in the loading environment. Previously it raised `ImportError`, making models authored in third-party packages unloadable by anyone without that package installed, even though the model is stored fully symbolically. Now the loader opportunistically re-imports the original class when possible (preserving subclass-specific Python behaviour) and otherwise warns and falls back to `BaseModel`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Test that li-ion BaseModel round-trips with options and defaults intact Covers the common case of a custom model that subclasses (or is reparented to) the lithium-ion BaseModel: after save + load, the recorded base class is re-imported, the options are restored as BatteryModelOptions, and the default_geometry / default_spatial_methods still cover the particle domains — so Simulation can discretise without the caller passing any extra geometry/submesh/spatial_methods dicts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Remove verbose inline comments Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Update changelog for #5441 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> (cherry picked from commit 428a181)
* replace edge eval override lambdas with standalone class * add test * Update CHANGELOG.md (cherry picked from commit 00d8bbd)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5442 +/- ##
==========================================
+ Coverage 98.24% 98.31% +0.07%
==========================================
Files 330 336 +6
Lines 30072 30699 +627
==========================================
+ Hits 29544 30183 +639
+ Misses 528 516 -12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
Patch release v26.3.1 cherry-picked on top of v26.3.0 with two bug fixes:
load_custom_modelraisingImportErrorwhen the saved base class lives in a package not installed in the loading environment (Fix load_custom_model when base class package is unavailable #5441)Release checklist
v26.3.1fromrelease/v26.3.1branch (notmain)pip install pybamm==26.3.1main(do NOT merge release branch back)release/v26.3.1branch after tagging🤖 Generated with Claude Code