Adding model variable attribute validation#1338
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1338 +/- ##
===========================================
- Coverage 94.99% 94.85% -0.14%
===========================================
Files 71 71
Lines 7366 7392 +26
===========================================
+ Hits 6997 7012 +15
- Misses 369 380 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ialisation-at-run-time
…run-time' of https://github.com/ImperialCollegeLondon/virtual_rainforest into 1337-validate-claimed-model-variable-initialisation-at-run-time
…ialisation-at-run-time
jacobcook1995
approved these changes
Feb 23, 2026
Collaborator
jacobcook1995
left a comment
There was a problem hiding this comment.
This seems like a sensible change to me!
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.
Description
This PR adds a function in
main.pythat checks that the variables added todataduring a model__init__or first_updateactually match thevars_populated_at_initandvars_populated_at_first_updateattributes of the model. These currently aren't validated and this seems like the simplest way to try and keep these attributes up to date.I think this could be extended to verify the other
var_attributes too, but keeping the variable population correct matters to resolving the model running order.Fixes #1337
Type of change
Key checklist
pre-commitchecks:$ pre-commit run -a$ poetry run pytestFurther checks