Skip to content

Extensions to attrs

Hynek Schlawack edited this page Jan 8, 2024 · 22 revisions

The following libraries build on attrs to provide additional functionality or have special support for attrs classes:

  • attrs2bin: Binary serializer for attrs-based classes.
  • attrs-strict: runtime validation for attributes specified in attrs dataclasses based on the type field provided.
  • bfa: Builders for attrs
  • cattrs: for structuring and unstructuring data
  • datargs: A paper-thin wrapper around argparse that creates type-safe parsers from dataclass and attrs classes.
  • desert: DRY deserialization for dataclasses and attrs classes.
  • marshmallow-attrs: Marshmallow serialization for attrs classes.
  • msgspec: fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML – and first-class support for attrs
  • prettyprinter: an extensible alternative to pprint comes with attrs support.
  • related: for creating nested object models that can be serialized to and de-serialized from nested python dictionaries
  • Rich supports pretty-printing of attrs classes.
  • serde: a performant serialization / deserialization extension to and from plain dicts.
  • spock: lightweight typed and stateful parameter configuration library (mainly for ML) that wraps attrs
  • typecats: Make attrs classes act more like structural (rather than nominal) typing; built on top of cattrs.
  • valid8: provides an alternate way to add validation to attributes, supporting various coding styles to define your validation functions and validation exception types/messages
  • yasoo: Serializes and deserializes attrs and dataclass objects without relying on type hints.
Clone this wiki locally