Stack Explorer

attrs

serialization

Python classes without boilerplate with validation and conversion

50M/week → Stable

Features

classesdataclassesvalidationboilerplatetyping

Pros and Cons

Ventajas

  • + Eliminates class boilerplate
  • + More features than dataclasses
  • + Validators and converters
  • + Optional immutability
  • + Very fast
  • + Mature and stable

Desventajas

  • - Competes with stdlib dataclasses
  • - API can be confusing
  • - Less popular than pydantic
  • - No native JSON serialization
  • - Documentation can be dense

Use Cases

  • Data class definition
  • Value objects
  • DTOs (Data Transfer Objects)
  • Application configuration
  • Domain models
  • Object immutability

Tecnologías Relacionadas

Alternatives

Related