from __future__ import annotations

import sys
import tomllib
from typing import TYPE_CHECKING, Any

if TYPE_CHECKING:
    from pathlib import Path


def load_toml_config(
    path_to_toml: str | Path,
) -> dict[str, Any]:
    with open(path_to_toml, 'rb') as f:
        data = tomllib.load(f)
    print('Loaded TOML config file successfully.', file=sys.stderr, flush=True)
    return data
