Valohai YAML Parser and Validator

0.56.0 · active · verified Fri Apr 17

valohai-yaml is a Python library for parsing, validating, and programmatically constructing `valohai.yaml` configuration files, which define machine learning pipelines and experiments for the Valohai platform. It ensures YAML configurations adhere to the Valohai schema. The current version is 0.56.0, and it maintains a frequent release cadence, often with minor updates and new feature support aligning with the Valohai platform.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to parse a `valohai.yaml` string using the `parse` function. It takes a YAML string as input and returns a `Config` object, which provides programmatic access to the defined steps, pipelines, and other Valohai configuration elements. This is the fundamental way to interact with Valohai YAML files in Python.

from valohai_yaml import parse

valohai_yaml_content = '''
- step: 
    name: training-step
    image: python:3.9
    command: python train.py
    inputs:
      - name: dataset
        default: s3://my-bucket/data/dataset.csv
    outputs:
      - name: model
        default: model.pkl
'''

config = parse(valohai_yaml_content)

print(f"Parsed Valohai config with {len(config.steps)} step(s).")
print(f"First step name: {config.steps[0].name}")

# Example of linting (requires more complex setup usually)
# from valohai_yaml import lint
# errors = lint(config)
# if errors: print(f"Linting errors: {errors}")

view raw JSON →