Skip to content

nexuml.core.scenario_loader

nexuml.core.scenario_loader

Trusted Python scenario/tuning file loading.

LoadedScenarioFile dataclass

Loaded trusted scenario file plus optional agent metadata.

project_root_for

project_root_for(path: Path) -> Path

Return the project root directory for a given path.

load_scenario_file

load_scenario_file(path: str | Path) -> LoadedScenarioFile

Load a trusted Python file exposing scenario() -> ScenarioSpec.

Returns:

Type Description
LoadedScenarioFile

Loaded scenario file with metadata, search space, and tuning spec.

Raises:

Type Description
FileNotFoundError

If path does not exist.

ValueError

If the file is not a .py file or lacks a callable scenario().

TypeError

If scenario() does not return a ScenarioSpec.