Core contracts for the FastSprout framework.
Foundation package — base protocols, types, exceptions and the typed-field layer that every other fastsprout-* package builds on. No dependencies on other framework packages.
pip install fastsprout-corefrom fastsprout_core.schema import BaseSchema
from fastsprout_core.fields import Field
class Hero(BaseSchema):
id: Field[int]
name: Field[str]
hero = Hero(id=1, name="SuperMan")
hero.name # "SuperMan" (str)
Hero.name # <Hero.name> (FieldRef[Hero, str, None])
Hero.name.set("Spider") # FieldAssignment(name='name', value='Spider')See examples/ for one runnable file per feature.
- Action protocols —
BaseAction,BaseSequenceAction,BaseIterableAction,BaseIteratorAction(+ trigger variants),BaseActionGroup. One protocol per return shape: single value,Sequence[O],Iterable[O],AsyncIterator[O]. - Schema —
BaseSchemawith snake↔camel aliasing, declares fields asField[T]. - Typed fields —
Field[T],FieldRef[E, T, OrmCtor],FieldAssignment[T],HasOrm[OrmCtor]. - Decorators —
@typed_fields,@typed_dataclass,@typed_pydantic_dataclass,TypedModelMeta. - Identifiers, errors, DI —
IDType(UUID v7),FastSproutError,Depends. - mypy plugin — refines
FieldRef.ormtoOrmCtor[T]. Enable withplugins = ["fastsprout_core.mypy_plugin"]in[tool.mypy].
3.12, 3.13, 3.14. CI runs the full pipeline on each, including PEP 749 lazy-annotation paths.
See CHANGELOG.md for what's in each version.
Apache License 2.0 — see LICENSE