# hydra_steps()

Get a check collection as a [Steps](../reference/Steps.md#pointblank.Steps) object.

Usage

[Source](https://github.com/posit-dev/pointblank/blob/main/pointblank/hydra.py#L532-L630)

``` python
hydra_steps(
    name,
    vars=None,
    config_dir=None,
    allow_python=False,
)
```

A check collection is an option of the `pointblank/checks` config group: a YAML file with a list of validation steps, in a project's own directory or in the config tree of an installed package. This gets the steps of one collection for use in a validation that's written in Python, where they're added with [`Validate.add_steps()`](../reference/Validate.add_steps.md#pointblank.Validate.add_steps).

The arguments of each step are used as they're written in the collection, as they are for the steps of a [`Contract`](../reference/Contract.md#pointblank.Contract), so the `python:` blocks of a collection aren't run.

## Parameters

`name: str`  
The collection, as it's selected in a `defaults:` list (e.g., `"ids"` or `"acme/emails"`).

`vars: Mapping[str, Any] | None = None`  
Values for the `${vars.<name>}` interpolations in the collection.

`config_dir: str | Path | None = None`  
A directory to add to the search path.

`allow_python: bool = False`  
Whether to make the mappings with a `_target_` key into the Python objects they describe (such as a custom check that a package provides). Without this, a collection with a `_target_` raises an error. Only set it for collections that you trust.

## Returns

`Steps`  
The steps of the collection.

## Raises

`ImportError`  
If neither `hydra-core` nor `lerna` is installed.

`YAMLValidationError`  
If there's no such collection, or it has an interpolation with no value.

## Examples

Let's write a check collection to a temporary directory. The column it checks is left as a variable.

``` python
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}
- rows_distinct:
    columns_subset: ${vars.id_column}
''')

id_checks = pb.hydra_steps("ids", vars={"id_column": "a"}, config_dir=config_dir)
id_checks
```

Steps -- 2 steps

1.col_vals_not_null(columns='a')

2.rows_distinct(columns_subset='a')

The steps can be added to any validation, alongside steps that are written in Python:

``` python
(
    pb.Validate(data=pb.load_dataset("small_table"))
    .add_steps(id_checks)
    .col_vals_gt(columns="d", value=100)
    .interrogate()
)
```

[TABLE]

The two steps of the collection come first in the validation, followed by the step that's written in Python.
