Skip to content

Entry API

sweet_tea.entry.Entry

Bases: BaseModel

A registry entry containing information about a registered class.

Each entry represents a class that has been registered with the factory system, including metadata for filtering and instantiation.

Source code in sweet_tea/entry.py
class Entry(BaseModel):
    """
    A registry entry containing information about a registered class.

    Each entry represents a class that has been registered with the factory system,
    including metadata for filtering and instantiation.
    """

    key: str = Field(
        description="Lowercase key used to reference this class for instantiation",
        examples=["myclass", "databaseconnection"],
    )

    class_def: type = Field(
        description="The actual class type that can be instantiated"
    )

    library: str = Field(
        default="",
        description="Name of the library or module group this class belongs to",
        examples=["mylib", "database"],
    )

    label: str = Field(
        default="",
        description="Optional label for categorizing classes (e.g., by environment or feature set)",
        examples=["production", "testing", "v2"],
    )