Skip to content

API Reference

fluxopt_yaml.loader

YAML loading and model construction for fluxopt.

load_yaml

load_yaml(path: str | Path) -> dict[str, Any]

Load a fluxopt model definition from a YAML file.

Parameters:

Name Type Description Default
path str | Path

Path to the YAML file.

required

Returns:

Type Description
dict[str, Any]

Parsed YAML content as a dictionary.

Source code in src/fluxopt_yaml/loader.py
def load_yaml(path: str | Path) -> dict[str, Any]:
    """Load a fluxopt model definition from a YAML file.

    Args:
        path: Path to the YAML file.

    Returns:
        Parsed YAML content as a dictionary.
    """
    path = Path(path)
    with path.open() as f:
        data: dict[str, Any] = yaml.safe_load(f)
    return data