Config API Reference

qualink.config — YAML-driven configuration for defining validation suites declaratively.

from qualink.config import (
    build_suite_from_yaml,
    run_yaml,
    load_yaml,
    parse_assertion,
    build_constraint,
    available_types,
)

qualink.config.builder

build_suite_from_yaml(source: str | Path, ctx: SessionContext | None = None) → ValidationSuiteBuilder

Parse source (file path or raw YAML string) and return a ready-to-run :class:ValidationSuiteBuilder.

If ctx is None a fresh SessionContext is created and the data_source or data_sources block in the YAML is used to register tables.

Returns the builder so callers can still chain .run()::

result = await build_suite_from_yaml("checks.yaml").run()


async run_yaml(source: str | Path, ctx: SessionContext | None = None) → ValidationResult

One-liner: parse YAML and execute immediately, returning the result.


qualink.config.parser

parse_assertion(raw: str | dict[str, Any]) → Assertion

Convert a YAML assertion value into an :class:Assertion instance.

Raises :class:ValueError on unrecognised input.


load_yaml(source: str | Path) → dict[str, Any]

Load and return a YAML config as a Python dict.

source may be a local file path, a filesystem URI, or a raw YAML string.


qualink.config.registry

class Kind(Enum)

Describes how constructor args are extracted from the YAML dict.

Member Value
Kind.COLUMN_THRESHOLD auto()
Kind.COLUMNS_THRESHOLD auto()
Kind.COLUMN_ASSERTION auto()
Kind.COLUMNS_ASSERTION auto()
Kind.TWO_COLUMN_ASSERTION auto()
Kind.ASSERTION_ONLY auto()
Kind.COLUMN_ONLY auto()
Kind.EXPRESSION auto()
Kind.STAT auto()
Kind.CUSTOM auto()

@dataclass(frozen=True)

class ConstraintDef

One-line specification for a YAML-configurable constraint.

Field Type Default
names tuple[str, ...] required
kind Kind required
import_path str required
extra dict[str, Any] field(default_factory=dict)
custom_build Any None

build_constraint(type_name: str, params: dict[str, Any]) → Constraint

Look up type_name and build a constraint from params.


available_types() → list[str]

Return sorted list of all registered type names (including aliases).


Assertion Shorthand Syntax

The parser supports these string formats for assertions in YAML:

String Result
"> 5" Assertion.greater_than(5)
">= 0.95" Assertion.greater_than_or_equal(0.95)
"< 100" Assertion.less_than(100)
"<= 120" Assertion.less_than_or_equal(120)
"== 1.0" Assertion.equal_to(1.0)
"between 0 100" Assertion.between(0, 100)

Inline Bound Keys

YAML Key Assertion Operator
gt >
gte >=
lt <
lte <=
eq ==
between between(lo, hi)