Skip to main content

Typico

PyPI License Package status Monthly downloads Distribution format Wheel availability Python version Implementation Releases Github Contributors Github Discussions Github Forks Github Issues Github Issues Github Watchers Github Stars Github Repository size Github last commit Github release date Github language count Github commits this month Package status PyUp

Read the documentation!

Typico

Typico is a powerful introspection library for Python data models, making it easy to work with Pydantic models, dataclasses, and other structured data in UI frameworks, form generators, and more.

Quick Start

from dataclasses import dataclass
from typing import Annotated
from pydantic import BaseModel, Field
from typico import get_model, get_fields, bind_model


# Works with Pydantic models
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)


# And with dataclasses
@dataclass
class Config:
    host: str = "localhost"
    """Server hostname"""
    port: int = 8080
    """Port number"""


# Get field information
user_fields = get_fields(User)
for field in user_fields:
    print(f"{field.name}: {field.raw_type} (required: {field.is_required})")

# Get complete model information
user_model = get_model(User)
print(f"Model: {user_model.name}, Fields: {len(user_model.fields)}")

# Create bindings to a specific instance
user = User(name="Jane", email="jane@example.com")
binding = bind_model(user)
print(f"Current name: {binding['name'].value}")
binding["name"].value = "Jane Doe"  # Update the value

Top-Level API

Function/Class Description
PyField Field metadata representation
PyModel Model metadata representation
Constraints Field validation constraints
FieldBinding Connects a field definition to an instance value
ModelBinding Connects a model definition to an instance
get_fields() Extract field metadata from a model class
get_model() Create a PyModel from a model class
bind_model() Create bindings between a model definition and an instance

Field Metadata (PyField)

The PyField class provides rich metadata about a field:

@dataclass
class PyField:
    name: str  # Field name
    raw_type: Any  # Python type annotation
    parent_model: type | None  # Parent model class
    field_type: str | None  # Custom field type (from annotations)
    title: str | None  # Display title
    description: str | None  # Detailed description
    placeholder: str | None  # Placeholder text
    examples: list[Any] | None  # Example values
    hidden: bool  # Whether field should be hidden
    readonly: bool  # Whether field is immutable
    deprecated: bool  # Whether field is deprecated
    is_required: bool  # Whether field is required
    default: Any  # Default value
    has_default: bool  # Whether field has a default
    constraints: Constraints  # Validation constraints
    metadata: dict[str, Any]  # Additional metadata

Model Metadata (PyModel)

The PyModel class encapsulates metadata about a model:

@dataclass
class PyModel:
    name: str                # Model class name
    fields: list[PyField]    # List of fields
    title: str               # Human-readable title
    description: str | None  # Detailed description
    frozen: bool            # Whether model is immutable
    metadata: dict[str, Any] # Additional metadata

    # Get fields with optional filtering
    def get_fields(
        self,
        required: bool | None = None,
        hidden: bool | None = None,
        readonly: bool | None = None,
        deprecated: bool | None = None,
        field_type: str | None = None,
    ) -> list[PyField]

Validation Constraints (Constraints)

The Constraints class captures validation rules for a field:

@dataclass
class Constraints:
    min_value: float | None = None  # Minimum value
    max_value: float | None = None  # Maximum value
    exclusive_min: bool = False  # Is min exclusive?
    exclusive_max: bool = False  # Is max exclusive?
    multiple_of: float | None = None  # Must be multiple of
    min_length: int | None = None  # Minimum length
    max_length: int | None = None  # Maximum length
    pattern: str | None = None  # Regex pattern
    min_items: int | None = None  # Min collection items
    max_items: int | None = None  # Max collection items
    allowed_values: list[Any] | None = None  # Allowed values

Data Bindings

Typico provides powerful bindings to connect model definitions with actual instances:

Field Binding

@dataclass
class FieldBinding:
    field: PyField           # Field metadata
    instance: Any            # Model instance
    ui_state: dict[str, Any] # UI state
    @property
    def value(self) -> Any:  # Get current value
    @value.setter
    def value(self, new_value: Any): # Set new value
    @property
    def is_valid(self) -> bool:      # Check if valid
    @property
    def validation_errors(self) -> list[str]: # Get errors
    def set_validation_errors(self, errors: list[str]) -> None


### Model Binding

```python
@dataclass
class ModelBinding:
    model: PyModel           # Model metadata
    instance: Any            # Model instance
    fields: list[FieldBinding] # Field bindings
    # Access fields by name
    def __getitem__(self, key: str) -> FieldBinding
    def get_field_binding(self, name: str) -> FieldBinding
    @classmethod
    def from_instance(cls, instance: object) -> ModelBinding

Custom Field Types

Typico supports custom field types through the field_type attribute in PyField. You can specify field types using the Annotated type:

from typing import Annotated
from pydantic import BaseModel


class User(BaseModel):
    username: str
    email: Annotated[str, {"field_type": "email"}]
    password: Annotated[str, {"field_type": "password"}]
    avatar: Annotated[str, {"field_type": "image"}]
    bio: Annotated[str, {"field_type": "markdown"}]

UI frameworks can use this information to render appropriate controls.

Integration with UI Frameworks

Typico is designed to work seamlessly with UI frameworks:

# Example with a hypothetical UI library
from typico import bind_model
from my_ui_lib import Form, TextField, EmailField, NumberField


def create_form(model_instance):
    binding = bind_model(model_instance)
    form = Form(title=binding.model.title)

    for field_binding in binding.fields:
        if field_binding.field.hidden:
            continue

        # handle fields here

        form.add_field(field)

    return form

License

MIT

Metadata

Release files for typico 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for typico 1.0.1
File Size Uploaded Provenance Actions
typico-1.0.1.tar.gz 25.2 kB With provenance Details for typico-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for typico 1.0.1
File Interpreter ABI Platform Actions
typico-1.0.1-py3-none-any.whl Python 3 none any Details for typico-1.0.1-py3-none-any.whl

Total release size: 53.6 kB

Release files / typico-1.0.1.tar.gz

Download URL typico-1.0.1.tar.gz
Size 25.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1ea32e51caab58d5b188925b68889ac7b11e14f06a33d1812297ceb6d5e03d08
BLAKE2b-256 checksum
How to use checksums
203289fc6e746e038efa45aa6f05af16b922fd8a745808dac75b77b2d506d2b6
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 log

Release files / typico-1.0.1-py3-none-any.whl

Download URL typico-1.0.1-py3-none-any.whl
Size 28.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ee1cbf0c5606265c2d6f454ddc234dee7e0fe2bbaca53b27661947905b8b785
BLAKE2b-256 checksum
How to use checksums
7aa8f54ecb71a2dfc0df8ce813cad65e0c34baca56804b9987a685f0ac3f95cc
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 log

Security for typico 1.0.1

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.

Select from 2 files

Attestation for typico-1.0.1.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 log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page