-
Notifications
You must be signed in to change notification settings - Fork 7
Labels
pythonRelates to one of the Ribasim python packagesRelates to one of the Ribasim python packages
Description
Ribasim Python users should avoid pydantic 2.12 or higher for now, e.g. uv add pydantic=2.11
. Pixi or Conda users don't need to as the cap has been applied in the feedstock with conda-forge/ribasim-feedstock#30.
The RijnenIJssel_2025_9_0
model was created with v2025.4.0. I can read it fine with Ribasim Python on the main branch. When reading it with v2025.5.0 you'd expect it to work as well, but I get:
>>> m = ribasim.Model.read(r"c:\Users\visser_mn\Downloads\RijnenIJssel_2025_9_0\wrij.toml")
Traceback (most recent call last):
File "<python-input-4>", line 1, in <module>
m=ribasim.Model.read(r"c:\Users\visser_mn\Downloads\RijnenIJssel_2025_9_0\wrij.toml")
File "C:\ProgramData\DevDrives\set\nl\RijnenIJssel\modellen\.venv\Lib\site-packages\ribasim\model.py", line 334, in read
return cls(filepath=filepath) # type: ignore
File "C:\ProgramData\DevDrives\set\nl\RijnenIJssel\modellen\.venv\Lib\site-packages\pydantic\main.py", line 250, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
File "C:\ProgramData\DevDrives\set\nl\RijnenIJssel\modellen\.venv\Lib\site-packages\ribasim\input_base.py", line 623, in set_sort_keys
field = cls.model_fields[getattr(info, "field_name")]
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'basin'
The error seems to be on the basin section of the TOML:
The TOML is:
starttime = 2017-01-01 00:00:00
endtime = 2018-01-01 00:00:00
crs = "28992"
input_dir = "input"
results_dir = "results"
ribasim_version = "2025.4.0"
[basin]
time = "basin_time.arrow"
We could of course do a new release, but I want to understand what this is. And also if it is just this model, or other models as well.
Metadata
Metadata
Assignees
Labels
pythonRelates to one of the Ribasim python packagesRelates to one of the Ribasim python packages
Type
Projects
Status
✅ Done