Skip to content

[python] Forbid any extra values in (base)model - #2595

Merged
visr merged 2 commits into
mainfrom
feat/forbid-custom-fields
Sep 24, 2025
Merged

visr merged 2 commits into
mainfrom
feat/forbid-custom-fields

Conversation

@evetion

@evetion evetion commented Sep 23, 2025

Copy link
Copy Markdown
Member

Fixes #2577.

This might break some Ribasim-NL usage.

I had to hardcode the edge field, as some (test)models still use it directly.

@visr

visr commented Sep 23, 2025

Copy link
Copy Markdown
Member

Great, thanks. I'd also be fine with dropping the edge alias in this cycle.

Curiously many new mypy failures like

python/ribasim_testmodels/ribasim_testmodels/allocation.py:1687: error: Unexpected keyword argument "area" for "Profile"  [call-arg]

Marking this as breaking to be sure, but to my knowledge Ribasim-NL doesn't use this.

@visr visr added the breaking A change that breaks existing models label Sep 23, 2025
@evetion

evetion commented Sep 24, 2025

Copy link
Copy Markdown
Member Author

Ok, made sure extra fields are allowed for initiating a TableModel to fix the mypy errors. I've removed the .edge fallback.

@visr
visr merged commit 38c85f0 into main Sep 24, 2025
@visr
visr deleted the feat/forbid-custom-fields branch September 24, 2025 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking A change that breaks existing models

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ribasim.Model accepts and passes arbitrary keys

2 participants