Typico
Typico is an introspection layer for Python data models. It reads Pydantic models, dataclasses and other fieldz-supported classes and describes them with one uniform set of objects: field metadata, validation constraints and instance bindings. That makes it a good foundation for form generators, UI frameworks and other tools that need to "understand" a model without caring which library defined it.
Installation
pip install typico
Requires Python 3.13+.
Quick start
from dataclasses import dataclass
from typing import Annotated
from pydantic import BaseModel, Field
from typico import bind_model, get_fields, get_model
class User(BaseModel):
name: str = Field(description="User's full name")
email: Annotated[str, {"field_type": "email"}]
age: int = Field(ge=0, le=120, default=30)
@dataclass
class Config:
host: str = "localhost"
"""Server hostname"""
port: int = 8080
"""Port number"""
# Field metadata, the same API for pydantic models and dataclasses
for field in get_fields(User):
print(field.name, field.raw_type, field.field_type, field.is_required)
# name <class 'str'> None True
# email <class 'str'> email True
# age <class 'int'> None False
print(get_fields(Config)[0].description) # "Server hostname" (from the attribute docstring)
print(get_fields(User)[2].constraints.max_value) # 120
# Model metadata
model = get_model(User)
print(model.name, [f.name for f in model.get_fields(required=True)]) # User ['name', 'email']
# Bind metadata to an instance, read / write values and validate
user = User(name="Jane", email="jane@example.com")
binding = bind_model(user)
binding["name"].value = "Jane Doe"
binding["age"].value = 500
result = binding.validate()
print(result.is_valid, result.field_messages)
# False {'age': ['Input should be less than or equal to 120']}
Key features
- One API for many model libraries: Pydantic models, dataclasses and anything fieldz understands (attrs, msgspec, ...).
- Rich field metadata (
PyField): type, title, description (also from dataclass attribute docstrings), examples / placeholder, default (MISSING_VALUEif none), required / hidden / readonly / deprecated flags and extra metadata. - Constraints (
Constraints): min / max values (inclusive or exclusive),multiple_of, string and collection length, regex pattern, allowed values. - Custom field types: hint a widget with
Annotated[str, {"field_type": "email"}]orField(json_schema_extra={"field_type": "email"}); available asPyField.field_type. - Bindings (
FieldBinding,ModelBinding): connect metadata to an instance, get / set values and validate. Pydantic models are validated with pydantic itself, other models with the extracted constraints. - UI building blocks (
typico.ui): abstractUIWidgetRenderer,TypeHandlerandFormRendererclasses to plug a concrete UI toolkit into.
Top-level API
| Name | Description |
|---|---|
PyField |
Field metadata |
PyModel |
Model metadata (fields, title, description, frozen, validator) |
Constraints |
Validation constraints of a field |
FieldBinding |
A field bound to an instance (value, validate(), is_valid) |
ModelBinding |
A model bound to an instance (binding["name"], validate()) |
get_fields() |
Extract the PyFields of a model class |
get_model() |
Create a PyModel from a model class |
bind_model() |
Create a ModelBinding for an instance |
Custom field types
from typing import Annotated
from pydantic import BaseModel
from typico import get_model
class Profile(BaseModel):
username: str
email: Annotated[str, {"field_type": "email"}]
password: Annotated[str, {"field_type": "password"}]
bio: Annotated[str, {"field_type": "markdown"}] = ""
model = get_model(Profile)
print([f.name for f in model.get_fields(field_type="email")]) # ['email']
Building UI forms
typico.ui contains the abstractions for rendering forms; it ships no concrete UI backend:
UIWidgetRenderer[T]: implementrender_text_input,render_text_area,render_number_input,render_checkbox,render_select,render_validation_errors,create_form_containerandrender_submit_buttonfor your toolkit.TypeHandler: decides whether itcan_handle(field)and returns the renderer method name plus keyword arguments fromprepare_for_render(binding). Handlers have apriority.FormRenderer: register handlers withregister_handler(), then callrender_model(instance), which renders all visible fields, the submit button and, after submission, validation errors.
from typico.ui import FormRenderer
renderer = FormRenderer(MyToolkitRenderer()) # your UIWidgetRenderer implementation
renderer.register_handler(MyStringHandler()) # your TypeHandler implementations
submitted, result = renderer.render_model(user)
License
MIT
Metadata
Release files for typico 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| typico-1.0.2.tar.gz | 25.4 kB | With provenance | Details for typico-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| typico-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for typico-1.0.2-py3-none-any.whl |
Total release size: 53.7 kB
Release files / typico-1.0.2.tar.gz
| Download URL | typico-1.0.2.tar.gz |
|---|---|
| Size | 25.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c662dbd2bdd2fcb2f26f954f5133b68e9904225fb1775406ae13fb5b16f21897
|
|
BLAKE2b-256 checksum How to use checksums |
6e0b1862a090594a7eb0c971f2e69c84d3e5207a176526aec596bffc89e5d029
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logRelease files / typico-1.0.2-py3-none-any.whl
| Download URL | typico-1.0.2-py3-none-any.whl |
|---|---|
| Size | 28.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d6b5a9f39f08449c9b48b011e3f660393cf0645fffe291ebf55ee2489ae5fad2
|
|
BLAKE2b-256 checksum How to use checksums |
02667391f0d36092f1d5e6f5f3e81d9ad4e0e1d8353c0c7028ae7a63d97d2d1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logSecurity for typico 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for typico-1.0.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.