Skip to content

Helper types

ValidationResult = bool | ErrorMessage

Callback validation result is either boolean or an error message.

ErrorMessage = TypeVar('ErrorMessage')

A string, callback validation error message.

TagValue = TypeVar('TagValue', bound=Any)

Any value. It is being wrapped by a Tag.

ChoicesType = list[TagValue] | tuple[TagValue] | set[TagValue] | dict[ChoiceLabel, TagValue] | list[Enum] | Type[Enum]

You can denote the choices in many ways. Either put options in an iterable or to a dict {labels: value}. Values might be Tags as well.

See mininterface.choice or Tag.choices for examples.

DataClass = TypeVar('DataClass')

Any dataclass. Or a pydantic model or attrs.

EnvClass = TypeVar('EnvClass', bound=DataClass)

Any dataclass. Its instance will be available through [miniterface.env] after CLI parsing.