-
Notifications
You must be signed in to change notification settings - Fork 9
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
Remove global config for dataclass_wizard #36
Remove global config for dataclass_wizard #36
Conversation
In working on the yaml configuration files in neural-lam I realised that setting global configuration for `dataclass_wizard` is a very bad idea. This should be obvious because different uses of `dataclass_wizard` might have different needs for configuration, however previously I didn't realise how to set the config when using `dataclass_wizard.YAMLWizard`. It turns out the key is to 1) also inherit from `dataclass_wizard.JSONWizard` (and make this the primary parent class) and 2) use `dataclass_wizard.JSONWizard.Meta` to define the config (not `dataclass_wizard.YAMLWizard.Meta` since this class does not exist). This commit removes the global config for `dataclass_wizard` and only sets the configuration on `mllam-data-preps` `mllam_data_prep.config.Config` config dataclass.
Hopefully the description above is clear @observingClouds, if not let's have a chat tomorrow. I would like for this to get into the next release, so I will bring it to the developer meeting next week. |
So if I understand correctly, the code here is about ensuring that all unkown parameters in the config files will raise an exception. Recently the With this PR you ensure that only the local dataclasses are affected as it now becomes part of the Not being familiar with the |
That's exactly right, yes! Thanks again for reviewing this. |
Merging this as per roadmap |
Thanks! Although I hadn't written anything in the changelog yet 😄 But I will do that when I prepare the |
Right, sorry about that 😅 Yes, please fix it with the 0.5.0 release. Maybe a good reason to have the PR template also here for MDP? |
In working on the yaml configuration files in neural-lam I realised that setting global configuration for
dataclass_wizard
is a very bad idea. This should be obvious because different uses ofdataclass_wizard
might have different needs for configuration, however previously I didn't realise how to set the config when usingdataclass_wizard.YAMLWizard
. It turns out the key is to 1) also inherit fromdataclass_wizard.JSONWizard
(and make this the primary parent class) and 2) usedataclass_wizard.JSONWizard.Meta
to define the config (notdataclass_wizard.YAMLWizard.Meta
since this class does not exist).This commit removes the global config for
dataclass_wizard
and only sets the configuration onmllam-data-preps
mllam_data_prep.config.Config
config dataclass.