Registry / serialization / springfield

springfield

JSON →
library0.9.1pypypi✓ verified 84d ago

A backend agnostic data modeling entity library. Current version 0.9.1, release cadence is irregular. Designed for flexible data modeling with support for multiple backends.

pip install springfield
INSTALL
IMPORT
SIG · SPRINGFIELD
S
springfield
serializationpythonv0.9.1
harness data pending
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.

Entity
from springfield import Entity
from springfield.models import Entity
Entity is available directly from the top-level package.
Field
from springfield import Field
from springfield.fields import Field
Field is also at the top-level.

Define an entity model with fields and instantiate it.

from springfield import Entity, Field class Person(Entity): name: str = Field() age: int = Field(default=0) person = Person(name='Alice', age=30) print(person.dict())
Debug
Known issues
gotchaUsing 'from springfield.models import Entity' leads to ImportError. Entity is at the top-level in version 0.9.x.
fix
Use 'from springfield import Entity'.
affects: >=0.9.0
gotchaThe library is still pre-1.0, expect API changes. Pin your dependency.
fix
Pin to 'springfield>=0.9,<1' in requirements.
affects: <1.0
Errors
Common errors & fixes
ImportError: cannot import name 'Entity' from 'springfield.models'
In version 0.9, Entity is exported from the top-level springfield module, not springfield.models.
fix
Change import to 'from springfield import Entity'.
AttributeError: 'Entity' object has no attribute 'dict'
The .dict() method may not exist if using older version <0.9.0 or if the model is not set up correctly.
fix
Ensure you are using springfield >=0.9.0 and that Person is defined with Field() for each attribute. Alternatively, use .to_dict().
Upgrade
Version history
0.9.1latest on PyPI · released Sep 15, 2020
Audit
Dependencies
pydanticoptionalspringfield often used with pydantic for data validation
Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
springfield — pip install springfield · libregistry