-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): config validation via pydantic
Fail early, fail gracefully. Implements config validation via pydantic for CosipyConfig (main_config), SlurmConfig (slurm_config) and Constants (constants_config, still needs more detailed model description). NOTE: Other configs are still missing. This provides config validation similar to dataclasses but more elaborate. The validation at runtime allows us to check early on if any config is missing or invalid and stops the model with informative error messages. Furthermore pydantic provides us type information, which makes it easier to extend the code as the project gets larger. While implementing this, I already found that the previous `Constants` class was missing some entries that are in the `constants.toml` file. Flattening the config structure (as done before) is now done before model validation by use of pydantics `@model_validator` decorator. NOTE: This is supposed to be a first draft and further details should be implemented. IMPORTANT: Look for NOTE, FIXME, and HACK comments in the code.
- Loading branch information
Showing
30 changed files
with
769 additions
and
608 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ nco | |
cdo | ||
cartopy | ||
vtk | ||
pydantic | ||
richdem | ||
coveralls | ||
codecov | ||
|
This file contains 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
Oops, something went wrong.