Uh oh!
There was an error while loading. Please reload this page.
Pydantic model - #487
Conversation
rettigl
commented
Aug 8, 2024
Generally, I find this a good idea, and also support directly using the pydantic models as config items. However, I don't like the idea to put again so many defaults into the code. If we remove all values there, and just make all parameters that are part of the default config as required, we would also get a consistent set, and also can make sure that certain values are available in the modules, no? |
zain-sohail
commented
Aug 21, 2024
Makes sense. I don't think there should be no problem in moving the defaults to how it currently is (in v1 branch). I did this because pydantic seems to promote the idea of defaults within model. I am still not satisfied with how the config and model looks for channels. Will try to think of a better structure. |
b98ab31 to
34f1441CompareUh oh!
There was an error while loading. Please reload this page.
Pull Request Test Coverage Report for Build 11456026831Details
💛 - Coveralls |
rettigl
commented
Oct 13, 2024
@zain-sohail I updated the mode and code so it passes tests and has all necessary fields. There are still some checks that could be added, and some tests for the schema could be added. |
zain-sohail
commented
Oct 13, 2024
Thanks a lot for fixing that. What checks are you thinking of? Regarding tests, generally, since Pydantic itself is well tested, we can expect it to do what it is supposed to. Or did you mean some integration testing? But I do find that after this config validation, a lot of checks within the rest code can be removed. Either I can look into it in this PR or we merge this and do that later. |
rettigl
commented
Oct 13, 2024
I thought about tests that the config fits to the model, and fails if additional entries are present, or required missing. The former e g was not working on your version. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
zain-sohail
commented
Oct 15, 2024
Should we merge this? |
rettigl
commented
Oct 15, 2024
There is still something wrong in the tutorials. I will have a look. I will also give it another review then. |
rettigl
left a comment
There was a problem hiding this comment.
Looks mostly good, apart from a few things still to fix. Let's resolve each point once addressed.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
rettigl
commented
Oct 21, 2024
@zain-sohail I fixed most of the issues. Please comment on the remaining ones, then we can merge here. |
* move static config to core * config model linting * test fixes
Please see the config model for complete possible schema. I extracted all parts from mpes and flashloader currently. Though mpes yaml config is not yet updated with the ConfigModel.
To run
This PR currently won't pass tests as it has config alterations that are breaking. Since creating a Pydantic schema/model, I thought it's good if the dataframe section is better streamlined.
So now there is a columns section. Instead of
we would need
Another thing to discuss: Whether we do a dict dump after schema verification or use the model itself. I prefer the model, as it makes a nice object oriented way of accessing values.
I won't update the other codebase until we decide if these alterations make sense. A Pydantic model for the updated config is also included here. This can be easily adapted to the config schema in v1, if necessary.
@rettigl please take a look.