Registry / ai-ml / valohai-yaml

valohai-yaml

JSON →
library0.57.0pypypi✓ verified 87d ago

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-yaml
INSTALL
IMPORT
SIG · VALOHAI-YAML
V
valohai-yaml
ai-mlpythonv0.57.0
Install
2.6s avg
Import
435ms
Disk
23MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.57.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.445s · 24.5MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.6s · import 0.425s · 25MB
23MB installed
● package 23MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse
from valohai_yaml import parse
from valohai_yaml.yaml import parse
Top-level `parse` is re-exported for convenience since v0.56.0. The submodule path still works but is less direct.
lint
from valohai_yaml import lint
from valohai_yaml.lint import lint
Top-level `lint` is re-exported for convenience since v0.56.0. The submodule path still works but is less direct.
build_config
from valohai_yaml import build_config
from valohai_yaml.build import build_config
Top-level `build_config` is re-exported for convenience since v0.56.0. The submodule path still works but is less direct.

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}")
Debug
Known issues
breakingSupport for Python 3.8 was dropped in version 0.47.0. Users on Python 3.8 will encounter installation or runtime errors.
fix
Upgrade your Python environment to version 3.9 or newer. `valohai-yaml` >=0.47.0 requires Python >=3.9.
affects: >=0.47.0
breakingIn version 0.47.0, the linter was updated to flag duplicate top-level entity names (e.g., two steps with the same name) as errors instead of warnings. Previously invalid configurations may now fail validation.
fix
Review your `valohai.yaml` files for any duplicate step, pipeline, or endpoint names and ensure all top-level entities have unique identifiers.
affects: >=0.47.0
gotchaVersion 0.56.0 changed serialization behavior to not serialize empty edge configs or default node error actions. If you rely on programmatic serialization to regenerate exact YAML structures, this might result in differences.
fix
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.
affects: >=0.56.0
gotchaThe `valohai-yaml` library exports various `Items` and `Enums` directly from the top-level package since v0.56.0 for convenience. While importing from submodules (e.g., `valohai_yaml.yaml.parse`) still works, the recommended path is direct import (`from valohai_yaml import parse`).
fix
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.
affects: >=0.56.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'valohai_yaml'
The `valohai-yaml` library is not installed in the current Python environment.
fix
Run `pip install valohai-yaml` to install the package.
valohai_yaml.errors.ValidationError: [YAML is not valid] ...
The provided YAML content does not conform to the Valohai YAML schema, or contains structural errors.
fix
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.
yaml.parser.ParserError: while parsing a block mapping
The input string contains malformed YAML syntax that even the underlying PyYAML parser cannot process, typically due to incorrect indentation, missing colons, or invalid character sequences.
fix
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.
AttributeError: 'NoneType' object has no attribute 'steps'
This usually happens when `valohai_yaml.parse()` fails due to invalid YAML, returns `None` or raises an exception, and subsequent code attempts to access attributes (like `steps`) on the non-existent or unhandled parsed object.
fix
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.
Upgrade
Version history
0.57.0latest on PyPI · released Apr 20, 2026
Audit
Dependencies
pythonrequiredRequires Python 3.9 or newer.
Agent activity
30 hits · last 30 days
node
28
OpenAI (training)
1
Resources
valohai-yaml — pip install valohai-yaml · libregistry