models module

class AppConfig(*, app_settings, modules=AppModules(tabs=[], windows=[]))

Bases: BaseModel

Root model — the entire YAML file maps onto this.

Parameters:
app_settings: AppSettings
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

modules: AppModules
class AppModules(*, tabs=[], windows=[])

Bases: BaseModel

Describes which modules appear as tabs and which as sidebar windows.

tabs → passed as tab_list to main_layout() windows → passed as window_list to main_layout()

Parameters:
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

tabs: list[ModuleConfig]
windows: list[ModuleConfig]
class AppSettings(*, port, service_prefix='', stylesheet='darkly', enable_logging=True, logging_level='info', log_to_file=False, variableselector)

Bases: BaseModel

Maps 1-to-1 onto the arguments of app_setup().

Parameters:
  • port (int)

  • service_prefix (str)

  • stylesheet (str)

  • enable_logging (bool)

  • logging_level (Literal['debug', 'info', 'warning', 'error', 'critical'])

  • log_to_file (bool)

  • variableselector (VariableSelectorConfig)

enable_logging: bool
log_to_file: bool
logging_level: Literal['debug', 'info', 'warning', 'error', 'critical']
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

port: int
classmethod port_in_range(v)
Return type:

int

Parameters:

v (int)

service_prefix: str
stylesheet: str
variableselector: VariableSelectorConfig
class ModuleConfig(*, type, **extra_data)

Bases: BaseModel

Represents one module entry in the YAML.

The type field must match the class name exactly (e.g. FreeSearch). All other keys in the YAML block become keyword arguments passed to the class constructor.

Example YAML:

- type: FreeSearch
  conn: null

- type: HbMethod
  label: "HB Method"
  some_param: 42
Parameters:
  • type (str)

  • extra_data (Any)

property extra_kwargs: dict[str, Any]

Return all fields that are NOT ‘type’, to be forwarded as **kwargs.

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

type: str
class RegisteredModule(*, type, as_tab, as_window, kwargs)

Bases: BaseModel

Parameters:
  • type (type[YamlLoadable])

  • as_tab (str | None)

  • as_window (str | None)

  • kwargs (list[str])

as_tab: str | None
as_window: str | None
kwargs: list[str]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

type: type[YamlLoadable]
class YamlLoadable

Bases: ABC

classmethod from_yaml(*args, **kwargs)

Base class for loading modules and other classes from a yaml config.

The method has a default implementation so you dont have to write it yourself, but the option to overwrite it remains for complicated modules. For examples modules that need specific class instances for __init__.

Parameters:
  • args (Any)

  • kwargs (Any)

classmethod from_yaml_path(yaml_path)

Method for reading a yaml file and parsing the contained module/layout

Parameters:

yaml_path (str)

get_from_module_registry(module_name)

Gets a registered module from the registry.

Return type:

RegisteredModule

Parameters:

module_name (str)

get_module_registry()