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.
pip install valohai-yamlVerified import paths — ran on the pinned version, not inferred.
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.
Upgrade your Python environment to version 3.9 or newer. `valohai-yaml` >=0.47.0 requires Python >=3.9.
Review your `valohai.yaml` files for any duplicate step, pipeline, or endpoint names and ensure all top-level entities have unique identifiers.
If programmatically generating or comparing YAML, be aware that empty configurations or default error actions may no longer be explicitly written to the YAML output. Adjust comparison logic if necessary.
Update your import statements to use the top-level exports, e.g., `from valohai_yaml import parse` instead of `from valohai_yaml.yaml import parse` for better future compatibility and readability.
Run `pip install valohai-yaml` to install the package.
Carefully review the YAML content against the Valohai documentation and the error messages provided by the `ValidationError` to identify and correct the invalid syntax or structure. Use `valohai_yaml.lint` for detailed validation reports.
Correct the YAML syntax. Pay close attention to indentation and standard YAML formatting rules. Tools like online YAML validators can help identify basic syntax errors.
Always wrap `parse()` calls in a `try...except valohai_yaml.errors.ValidationError` block, or check the return value to ensure it's not `None` before attempting to access its attributes. Ensure the YAML input is valid.