-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Since we're already using attrs, there would be several potential benefits from using cattrs, which could be considered a pre-serialization/post-deserialization optimization step. It uses attrs definitions to recursively unstructure classes and nested data structures into dicts and builtin types, and vice versa. In relational db terms, this is similar to adding a serialization library (like Marshmallow) on top of an ORM framework (like SQLAlchemy), but without needing to define a separate model + serialization schema. There are some more details on how it works in this article.
This would make both serialization and deserialization a little more efficient, avoid some edge cases inherent with pickling (or more specifically unpickling classes), and open up the possibility for other serialization formats like JSON.