Comparison
cattrs vs dataclasses-json vs marshmallow vs msgspec
Maintenance, adoption and momentum side by side, from PyPI, GitHub and deps.dev data refreshed every day.
Composable complex class support for attrs and dataclasses.
Actively maintained. Last release 2 months ago, commits in 16 of the last 26 weeks. A safe choice.
pip install cattrsEasily serialize dataclasses to and from JSON.
Low maintenance activity. Last release over 2 years ago, commits in 0 of the last 26 weeks. Weaker on commit activity and recent releases.
pip install dataclasses-jsonA lightweight library for converting complex datatypes to and from native Python datatypes.
Actively maintained. Last release 4 weeks ago, commits in 21 of the last 26 weeks. A safe choice.
pip install marshmallowA fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML.
Actively maintained. Last release 3 days ago, commits in 19 of the last 26 weeks. A safe choice.
pip install msgspecIn short
- marshmallow is the most used: 91.3M downloads a month, 1.8× more than dataclasses-json.
- Maintenance is comparable: marshmallow 92, msgspec 83, cattrs 83, dataclasses-json 22 on Pythie’s Index.
- msgspec is growing fastest: downloads +13% over the last month.
- Safe default for a new project: marshmallow.
Side by side
| Metric | cattrs | dataclasses-json | marshmallow | msgspec |
|---|---|---|---|---|
| Pythie’s Index | Pythie’s Index: 83 | 22 |