Skip to main content

hydra_interrogate()

Compose a validation configuration with Hydra and run it.

Usage

Source

hydra_interrogate(
    config=None,
    overrides=None,
    config_dir=None,
    set_tbl=None,
    namespaces=None,
    allow_python=False,
)

This composes the configuration with hydra_compose() and then does what yaml_interrogate() does with a plain YAML configuration.

Parameters

config: str | Path | None = None

The path to a YAML file to compose (see hydra_compose()).

overrides: Iterable[str] | None = None

Hydra overrides (see hydra_compose()).

config_dir: str | Path | None = None

A directory to add to the search path.

set_tbl: Any = None

A table to validate in place of the one in the configuration.

namespaces: Iterable[str] | Mapping[str, str] | None = None

Modules to make available to Python code in the configuration, as a mapping of aliases to module names or a list of module names. This only has an effect with allow_python=True.

allow_python: bool = False
Whether to run the Python code in the configuration: the code of python: blocks (see yaml_interrogate()), and the mappings with a _target_ key, which are made into the Python objects they describe. Without this, a configuration with such code raises an error. Only set it for configurations that you trust.

Returns

Validate
The interrogated validation.

Raises

ImportError

If neither hydra-core nor lerna is installed.

YAMLValidationError
If the configuration can’t be composed, isn’t valid, or can’t be run.

Examples

Let’s write a check collection and a configuration that selects it to a temporary directory. The configuration also selects the small_table dataset and the standard thresholds, which are options that come with Pointblank.

import pointblank as pb
import tempfile
from pathlib import Path

config_dir = Path(tempfile.mkdtemp())
(config_dir / "pointblank" / "checks").mkdir(parents=True)

(config_dir / "pointblank" / "checks" / "ids.yaml").write_text('''
# @package checks.ids
steps:
- col_vals_not_null:
    columns: ${vars.id_column}
''')

(config_dir / "small_table.yaml").write_text('''
defaults:
- override /pointblank/tbl: small_table
- override /pointblank/thresholds: standard
- override /pointblank/checks:
    - ids
- _self_

vars:
  id_column: a

steps:
- rows_distinct
''')

pb.hydra_interrogate(config_dir / "small_table.yaml")
Pointblank Validation
2026-12-04|20:52:29
PolarsWARNING0.05ERROR0.1CRITICAL0.15
STEP COLUMNS VALUES TBL EVAL UNITS PASS FAIL W E C EXT
#4CA64C 1
col_vals_not_null
col_vals_not_null()
a — ✓ 13 13
1.00
0
0.00
○ ○ ○ —
#FF3300 2
rows_distinct
rows_distinct()
ALL COLUMNS — ✓ 13 11
0.85
2
0.15
● ● ●

The validation has the step of the collection, followed by the step of the configuration. Overrides change what’s selected for one run. Here the same checks are run on another column with the strict thresholds:

pb.hydra_interrogate(
    config_dir / "small_table.yaml",
    overrides=["pointblank/thresholds=strict", "vars.id_column=c"],
)
Pointblank Validation
2026-12-04|20:52:29
PolarsWARNING0.01ERROR0.05CRITICAL0.1
STEP COLUMNS VALUES TBL EVAL UNITS PASS FAIL W E C EXT
#FF3300 1
col_vals_not_null
col_vals_not_null()
c — ✓ 13 11
0.85
2
0.15
● ● ●
#FF3300 2
rows_distinct
rows_distinct()
ALL COLUMNS — ✓ 13 11
0.85
2
0.15
● ● ●

Column c has two missing values, so the first step now fails for two of the 13 test units, which is enough to reach all three levels of the strict thresholds.