Replies: 6 comments 2 replies
-
any tools/libraries you know that might be helpful? |
Beta Was this translation helpful? Give feedback.
-
https://stackoverflow.com/questions/6578986/how-to-convert-json-data-into-a-python-object I assume the same thing is possible for YAML. However doing it on the fly has the downside, that it has no documentation. |
Beta Was this translation helpful? Give feedback.
-
I guess YAML/ASDF -> Python dataclass for our use case is simple enough, with some ASDF tools we should be able to quickly generate quite clean code files An older jinja template can be found here If we just want to have .attr acces something simpler like your link might suffice Maybe this is relevant as well? https://github.com/konradhalas/dacite |
Beta Was this translation helpful? Give feedback.
-
also just leaving this here for reference https://stackoverflow.com/questions/53376099/python-dataclass-from-a-nested-dict |
Beta Was this translation helpful? Give feedback.
-
if we just want to have an attribute like access styles maybe attrdict is handy |
Beta Was this translation helpful? Give feedback.
-
I think
should be an easy fix but unfortunately We should probably look for alternatives before relying too much on it? @marscher |
Beta Was this translation helpful? Give feedback.
-
Having to access a deserialized asdf file via dictionary keys works fine, but is not especially user/programmer friendly, as there is no auto-completion and documentation (like of properties/accessor methods)
For example:
Additionally if the schema changes, scripts accessing the dictionary directly are likely to fail.
So we should think of wrapping the schemas in Python classes/objects to avoid breaking compatibility on schema changes. There are automated ways of doing so, but we should discuss, what features are desirable before sticking to a library. We can even decide of doing it manually, but this would introduce another maintenance job keeping the schemas and classes in sync.
Beta Was this translation helpful? Give feedback.
All reactions