-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pydantic model #487
Pydantic model #487
Conversation
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? |
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
34f1441
Compare
ebf2e87
to
d84f6e4
Compare
Pull Request Test Coverage Report for Build 11456026831Details
💛 - Coveralls |
@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. |
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. |
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. |
Should we merge this? |
There is still something wrong in the tutorials. I will have a look. I will also give it another review then. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good, apart from a few things still to fix. Let's resolve each point once addressed.
@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.