On this page
  1. enforce-type
  2. Role
  3. Install
  4. Quickstart
  5. When to Reach for It
  6. Gotchas & Pitfalls
  7. Pairs With
  8. Metadata

enforce-type

Prev: escape-colors | Up: projects | Next: kindof
Rel: wispsy, Foundation, kindof
Ref: wispsy on GitHub
Tags: #public #wispsy #project #foundation #tier/core


Role

Independent pure-Python compiled validation for ordinary type annotations (check, load, dump, load_partial), with Annotated constraints (Min, Max, Length) and opt-in scalar coercion.

Install

python -m pip install enforce-type

Quickstart

from dataclasses import dataclass
from enforce_type import compile_type

@dataclass
class User:
    name: str
    age: int
    active: bool = True

users = compile_type(User)
user = users.load({"name": "Ella", "age": 34})
assert users.check(user) is user
assert users.dump(user) == {"name": "Ella", "age": 34, "active": True}

When to Reach for It

Gotchas & Pitfalls

Pairs With


Metadata

type: project-card
slug: enforce-type
org: wispsy
repo: wispsy/enforce-type
package: enforce-type
version: 0.2.0
requires_python: ">=3.14"
layer: foundation
topic: wispsy-foundation
status: active
language: python
source_docs: README.md, docs/

Linked from

Related notes