maggma
maggma copied to clipboard
FEATURE: Upgraded MSONable
MSONable is great but has a couple flaws:
- support pydantic
BaseModelfor defining the data model - better handling of serializing components
- Better encapsulation of serialization methods. This is particularly a problem where some classes completely break their
as_dictandfrom_dict.
We should start thinking about a new MSONable defined here and then later if desired moved back into monty.
Better integration with pandas would be nice too.
I've been enjoying using a dataclass that also subclasses MSONable recently, very powerful. Not sure how pydantic would works with data classes currently.
Someone doing a review of MP-critical classes and if/why they have custom as_dict/from_dicts would be helpful too, I'm not convinced these are necessary in a majority of cases.