Registry / serialization / fields

fields

JSON →
library5.0.0pypypi✓ verified 86d 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.

pip install fields
INSTALL
IMPORT
SIG · FIELDS
F
fields
serializationpythonv5.0.0
Install
1.5s avg
Import
—
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v5.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

Fields
✓ from fields import Fields
✗ from fields import Field
BareFields
✓ from fields import BareFields
ConvertibleFields
✓ 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 issues
breakingClassmethod and staticmethod descriptors conflict with field inspection; avoid using them inside @fields classes.
fix
Define classmethods/staticmethods outside the @fields class or use a different decorator pattern.
affects: >=1.0.0
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.
fix
Use keyword argument 'name' only when necessary; prefer relying on the variable name.
affects: >=1.0.0
deprecatedThe 'validate' parameter in Field is deprecated in 5.0.0; use the 'check' parameter instead.
fix
Replace Field(validate=func) with Field(check=func).
affects: 5.0.0
Upgrade
Version history
5.0.0latest on PyPI · released Apr 13, 2016
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
fields — pip install fields · libregistry