Registry / serialization / fields

fields

JSON →
library5.0.0pypypi✓ verified 30d ago

A Python library for eliminating class boilerplate by providing an attrs/dataclass-like container class with built-in validation and transformation. Current version is 5.0.0, released on 2025-12-05. Development appears slow; pre-5.0.0 releases were irregular.

serialization
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from fields import Fields
from fields import BareFields
from fields import ConvertibleFields

Define a container class with automatic __init__, __repr__, and validation via type hints and Field descriptors.

from fields import fields, Field @fields class Point: x: int = Field(required=True) y: int = 0 p = Point(x=3) print(p.x, p.y) # 3 0
Debug
Known footguns
breakingClassmethod and staticmethod descriptors conflict with field inspection; avoid using them inside @fields classes.
gotchaField name checking uses both the slot name and the variable name; renaming a field variable but not updating the Field's 'name' argument can cause silent failures.
deprecatedThe 'validate' parameter in Field is deprecated in 5.0.0; use the 'check' parameter instead.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources