JakkuSakura / typedmodel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypedModel

TypedModel aims to provide strict type checking for dataclass and pydantic model.

dataclass is useful, but provides no type checking

pydantic is useful, but sometimes it bugs out

pydantic/pydantic#3189

pydantic/pydantic#3569

Usage

pip install typedmodel
from typedmodel import BaseModel


class Foo(BaseModel):
    a: str
    b: str
    d = 'default'
    e: str = 'default'


foo = Foo(a="a", b="b")

check tests for more use cases

About


Languages

Language:Python 98.9%Language:Shell 1.1%