#!/usr/bin/env python3
"""Standalone LibreVNA generator sweep driven by a local Python config."""

from __future__ import annotations

import logging
import sys

from pathlib import Path

PROJECT_ROOT = Path(__file__).resolve().parents[2]
if str(PROJECT_ROOT) not in sys.path:
    sys.path.insert(0, str(PROJECT_ROOT))

from python_app.generator_sweep.config import resolve_generator_sweep_config
from python_app.scripts.librevna_generator_sweep_config import CONFIG


def main() -> int:
    """Load local generator config and execute the sweep."""
    resolved = resolve_generator_sweep_config(CONFIG)
    logging.basicConfig(
        level=resolved.log_level,
        format="%(asctime)s %(levelname)s %(name)s: %(message)s",
    )

    from python_app.generator_sweep.runner import GeneratorSweepRunner

    runner = GeneratorSweepRunner(CONFIG)
    runner.run()
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
