skillfed

cattrs

Composable complex class support for attrs and dataclasses.

cattrs Permissive license MIT Active 1,049 v26.1.0 released

Install

cattrs on PyPI

pip

pip install cattrs

uv

uv add cattrs

poetry

poetry add cattrs

Package 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTyping :: Typed

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.
dict to dataclass conversionattrs serialization deserializationstructured data validationjson to typed objectrecursive object structuringattrs unstructuringtype-safe data conversion

Similar packages