Pydantic and Mypy
This project uses Mypy for typechecking, and Pydantic for runtime validation.
While Pydantic uses type annotations to determine runtime validation behavior, it also
effectively overrides your annotation with
reveal_type(MyModel)!). This is
because Pydantic needs to be able to convert compatible values. Pydantic’s mypy
plugin, which we use,
init_typed setting, which we do not use, to “correctly” annotate the
__init__ method of models, with the downside that Mypy throws errors when you take
advantage of Pydantic’s type conversion behavior.
For this reason, it is expected that QGreenland config files would pass type checking when instantiating Pydantic models with incorrect field types. These would instead fail runtime validation.