Skip to content

Use cattrs to optimize response serialization #67

@JWCook

Description

@JWCook

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.

Metadata

Metadata

Assignees

Labels

logisticsCI builds, project config, refactoring, and other logistical detailsperformance

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions