Skip to content

Configuration

evaldeck.config.EvaldeckConfig

Bases: BaseModel

Main evaldeck configuration.

load classmethod

load(path=None)

Load configuration from file.

Searches for evaldeck.yaml, evaldeck.yml in order.

Source code in src/evaldeck/config.py
@classmethod
def load(cls, path: str | Path | None = None) -> EvaldeckConfig:
    """Load configuration from file.

    Searches for evaldeck.yaml, evaldeck.yml in order.
    """
    if path:
        path = Path(path)
        if not path.exists():
            raise FileNotFoundError(f"Config file not found: {path}")
        return cls._load_file(path)

    # Search for config file
    for name in ["evaldeck.yaml", "evaldeck.yml"]:
        p = Path(name)
        if p.exists():
            return cls._load_file(p)

    # Return default config
    return cls()

save

save(path)

Save configuration to file.

Source code in src/evaldeck/config.py
def save(self, path: str | Path) -> None:
    """Save configuration to file."""
    with open(path, "w") as f:
        yaml.dump(self.model_dump(exclude_none=True), f, default_flow_style=False)