Description
Python has a rich set of powerful, easy to use, built-in data types like
dictionaries, lists and tuples. These data types are also the lingua franca
of most data serialization libraries, for formats like json, msgpack, yaml or
toml.
Data types like this, and mappings like dict s in particular, represent
unstructured data. Your data is, in all likelihood, structured: not all
combinations of field names are values are valid inputs to your programs. In
Python, structured data is better represented with classes and enumerations.
attrs is an excellent library for declaratively describing the structure of
your data, and validating it.
When you're handed unstructured data (by your network, file system, database...),
cattrs helps to convert this data into structured data. When you have to
convert your structured data into data types other libraries can handle,
cattrs turns your classes and enumerations into dictionaries, integers and
strings.
Here's a simple taste. The list containing a flo
cattrs alternatives and similar packages
Based on the "Serialization" category.
Alternatively, view cattrs alternatives based on common mentions on social networks and blogs.
-
marshmallow
A lightweight library for converting complex objects to and from simple Python datatypes. -
ultrajson
Ultra fast JSON decoder and encoder written in C with Python bindings -
mashumaro (マシュマロ)
Fast and well tested serialization library on top of dataclasses -
Fast JSON schema for Python
Fast JSON schema validator for Python. -
RDFLib plugin providing JSON-LD parsing and serialization
JSON-LD parser and serializer plugins for RDFLib -
Trafaret
Ultimate transformation library that supports validation, contexts and aiohttp. -
lupin is a Python JSON object mapper
Python document object mapper (load python object from JSON and vice-versa) -
py-object-factory
objectfactory is a python package to easily implement the factory design pattern for object creation, serialization, and polymorphism
Write Clean Python Code. Always.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of cattrs or a related project?