TL;DR - adds the from_dict class method to all the configuration data models to enable creating new model objects from dictionaries. For example, here's how you could create a node using the from_dict method:
The new option module is then responsible for validating that the values passed to from_dict are correct, add provides the marshallers for when you go to dump the configuration into a file. The option module also removes the "hacky" implementation for callbacks which just uses a MappingProxy embedded into the data model as a protected attribute.
BREAKING CHANGES: I removed the NodeMap, PartitionMap, DownNodesList wrappers as I was not enamored with their implementation. They were rushed. I took them out as I'd like to spend more time refining their implementation so they aren't as hacky/clunky. Let me know if you'd like for me to add them back in. We can like open a follow-on PR that focuses on their implementation, but for now we have enough to unblock https://github.com/charmed-hpc/hpc-libs/pull/22
Side note: I need to update the README and pyproject.toml before merging this PR, but I want to know your thoughts on the "from_dict(...) and back again" implementation before going ahead and handling that.
TL;DR - adds the
from_dict
class method to all the configuration data models to enable creating new model objects from dictionaries. For example, here's how you could create a node using thefrom_dict
method:The new
option
module is then responsible for validating that the values passed tofrom_dict
are correct, add provides the marshallers for when you go to dump the configuration into a file. Theoption
module also removes the "hacky" implementation for callbacks which just uses aMappingProxy
embedded into the data model as a protected attribute.BREAKING CHANGES: I removed the
NodeMap
,PartitionMap
,DownNodesList
wrappers as I was not enamored with their implementation. They were rushed. I took them out as I'd like to spend more time refining their implementation so they aren't as hacky/clunky. Let me know if you'd like for me to add them back in. We can like open a follow-on PR that focuses on their implementation, but for now we have enough to unblock https://github.com/charmed-hpc/hpc-libs/pull/22Closes #14