cattrs
Composable complex class support for attrs and dataclasses.
Install
cattrs on PyPI
pip
pip install cattrsuv
uv add cattrspoetry
poetry add cattrsPackage facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — attrs, exceptiongroup, typing-extensions |
| Maintenance | actively maintained — 176 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: cattrs-26.1.0-py3-none-any.whl
Keywords: attrs, dataclasses, serialization
About cattrs
from the package's own PyPI description — quoted content, verbatim
cattrs: Flexible Object Serialization and Validation
Because validation belongs to the edges.
Documentation (image) License: MIT (image) PyPI (image) Supported Python Versions (image) Downloads (image) Coverage (image)
<!-- begin-teaser -->
cattrs is a Swiss Army knife for (un)structuring and validating data in Python. In practice, that means it converts unstructured dictionaries into proper classes and back, while validating their contents.
<!-- end-teaser -->
Example
<!-- begin-example -->
cattrs works best with...
Read as markdown · JSON record · Source repository · Homepage · Docs
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
cattrs converts unstructured dictionaries into typed Python classes (attrs, dataclasses) and back, with recursive validation and support for complex nested structures and multiple serialization formats.
Low friction: pure Python wheel with only three stable runtime dependencies (attrs, exceptiongroup, typing-extensions). Active maintenance with recent releases and 1049 repository stars.
MIT permissive license allows unrestricted commercial and private use with minimal attribution requirements.
Usage
pip install cattrs
from attrs import define
from cattrs import structure, unstructure
@define
class C:
a: int
b: list
data = {'a': 1, 'b': ['x', 'y']}
instance = structure(data, C)
unstructure(instance)
Requires Python 3.10 or later.
Verdict: cattrs is a production-stable, actively maintained library with no known vulnerabilities, low install friction, and permissive MIT licensing. It excels at converting between unstructured data and typed Python objects with minimal boilerplate, making it well-suited for serialization, API validation, and data transformation pipelines.
Needs verification
- Performance characteristics compared to alternative serialization libraries in typical workloads.
- Extent of support for custom types beyond the documented built-in conversions.
- Real-world adoption metrics beyond repository stars and PyPI tier ranking.
Similar packages
permissive · top 100 on PyPI
blackpermissive · top 1,000 on PyPI
hypothesiscopyleft · top 1,000 on PyPI
typing-inspectpermissive · top 1,000 on PyPI
dacitepermissive · top 1,000 on PyPI
ujsonpermissive · top 1,000 on PyPI
ormsgpackpermissive · top 1,000 on PyPI
mashumaropermissive · top 1,000 on PyPI
dataclasses-jsonpermissive · top 1,000 on PyPI
cycloptspermissive · top 1,000 on PyPI