Skip to content

flixOpt.config

Classes

CONFIG

A configuration class that stores global configuration values as class attributes.

Functions

load_config classmethod
load_config(user_config_file: Optional[str] = None)

Initialize configuration using defaults or user-specified file.

to_dict classmethod
to_dict()

Convert the configuration class into a dictionary for JSON serialization. Handles dataclasses and simple types like str, int, etc.

Functions

merge_configs

merge_configs(defaults: dict, overrides: dict) -> dict

Merge the default configuration with user-provided overrides.

:param defaults: Default configuration dictionary. :param overrides: User configuration dictionary. :return: Merged configuration dictionary.

dataclass_from_dict_with_validation

dataclass_from_dict_with_validation(cls, data: dict)

Recursively initialize a dataclass from a dictionary.

setup_logging

setup_logging(default_level: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] = 'INFO', log_file: Optional[str] = 'flixOpt.log', use_rich_handler: bool = False)

Setup logging configuration