Skip to content

Configuration

Special section

In a YAML config file, use a special section 'mininterface' to set up the UI. For example, this stub will enforce your program to use the Tui interface.

mininterface:
    interface: tui

Complete example

Source of program.py, we have one single attribute foo:

from typing import Annotated
from dataclasses import dataclass
from mininterface import run, Choices

@dataclass
class Env:
    foo: Annotated["str", Choices("one", "two")] = "one"

m = run(Env)
m.form()

Source of program.yaml will enforce the comboboxes:

number: 5
mininterface:
    gui:
        combobox_since: 1

The difference when using such configuration file.

Configuration not used Configuration used

MininterfaceConfig

interface: Literal['gui'] | Literal['tui'] | None = None

Enforce an interface. By default, we choose automatically.

Gui

combobox_since: int = 5

The threshold to switch from radio buttons to a combobox.

Tui