Skip to content

skimindex.config.validate

skimindex.config.validate

Config validation for skimindex — checks all structural invariants and cross-section dependencies, reporting every violation with a clear message.

Usage

from skimindex.config import validate, validate_or_raise

errors = validate(cfg) # list[ConfigError], empty if valid validate_or_raise(cfg) # raises ConfigValidationError if any errors

ConfigError dataclass

ConfigError(section: str, key: str, message: str)

A single config validation error with location and description.

Attributes:

Name Type Description
section str

TOML section path, e.g. "data.fungi" or "processing.prepare_decontam".

key str

Key within the section, e.g. "divisions" or "run".

message str

Human-readable description of the violation.

ConfigValidationError

ConfigValidationError(errors: list[ConfigError])

Bases: Exception

Raised by validate_or_raise() when the config has one or more errors.

validate

validate(cfg: Config) -> list[ConfigError]

Return all validation errors found in cfg (empty list = valid).

validate_or_raise

validate_or_raise(cfg: Config) -> None

Raise ConfigValidationError listing all errors, or return silently if valid.