rom-py / rompy

Relocatable Ocean Modelling in PYthon (rompy) combines templated cookie-cutter model configuration with various xarray extensions to assist in the setup and evaluation of coastal ocean model
https://rom-py.github.io/rompy/
BSD 3-Clause "New" or "Revised" License
2 stars 9 forks source link

Version >2.6 of Pydantic require Field names to be different from type annotations #67

Open benjaminleighton opened 8 months ago

benjaminleighton commented 8 months ago

https://docs.pydantic.dev/2.6/errors/usage_errors/#unevaluable-type-annotation

This happens for example in https://github.com/rom-py/rompy/blob/f3b4af91c546d34abbcc09d6f677575c5af8ddf8/rompy/schism/namelists/cosine.py#L253

because

MARCO the type is potentially confused with MARCO the field name on the COSINE class one of the ways to resolve this is to define a new variable to hold the type/class with a different name and use that like

MARCO_AS_TYPE = MARCO ... MARCO: MARCO_AS_TYPE = Field(..., description="MARCO parameters")

tomdurrant commented 6 months ago

Ok, noted. These namelists are not currently used, so let me now if this is causing any issues with the current CSIRO implementation, if so, I'll just remove the imports, otherwise, I will wait for the full namelist implementation to fix