Registry / ai-ml / valohai-utils

valohai-utils

JSON →
library0.7.0pypypi✓ verified 86d ago

Utilities for building and running machine learning pipelines on the Valohai platform. Version 0.7.0, stable but occasional updates for Valohai API changes.

pip install valohai-utils
INSTALL
IMPORT
SIG · VALOHAI-UTILS
V
valohai-utils
ai-mlpythonv0.7.0
Install
3.2s avg
Import
1094ms
Disk
27MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.7.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.95 runs
installs and imports cleanly · install 0.0s · import 1.138s · 28.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.2s · import 1.050s · 29MB
27MB installed
● package 27MB
Code
Verified usage

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

valohai
import valohai
import valohai_utils
valohai-utils is the PyPI package, but importable as valohai
task_context
from valohai import task_context
from valohai.utils import task_context
Renamed in older versions; always use valohai.task_context
Inputs
from valohai.internals.inputs import Inputs
from valohai import Inputs
Inputs helper is in internals submodule, not direct import

Minimal Valohai pipeline step using task_context for input/output management.

import valohai from valohai import task_context if __name__ == '__main__': with task_context() as ctx: # Access input files for file_path in ctx.inputs['dataset']: print(f"Processing {file_path}") # Write outputs for output_name in ctx.outputs: ctx.write_output(output_name, data=[], output_path='/some/path')
valohai --version
Debug
Known issues
breakingIn v0.5+, task_context no longer auto-uploads outputs; you must explicitly call ctx.upload_outputs() or use write_output which auto-uploads.
fix
After writing outputs, call ctx.upload_outputs() or use ctx.write_output() which handles upload.
affects: >=0.5.0
gotchaInputs are accessed via comma-separated values in the pipeline YAML. If you define an input as 'dataset', you must use ctx.inputs['dataset'] — case-sensitive and matches exactly the YAML key.
fix
Use ctx.inputs['input_name'] exactly as defined in valohai.yaml under inputs:.
affects: all
gotchaThe local execution mode does not validate Valohai API tokens; scripts that work locally may fail on Valohai due to missing environment variables.
fix
Always test on Valohai or use valohai-utils in an environment with VALOHAI_TOKEN set.
affects: all
deprecatedvalohai.prepare_execution() is deprecated. Use valohai.initialize() or task_context instead.
fix
Replace valohai.prepare_execution() with valohai.initialize() and use task_context.
affects: <=0.4
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'valohai'
The import is 'valohai' not 'valohai_utils'. The package is installed as valohai-utils but import uses valohai.
fix
Install valohai-utils (pip install valohai-utils) then use 'import valohai'.
KeyError: 'dataset' when accessing ctx.inputs['dataset']
The input name in code does not match the key defined in valohai.yaml inputs section.
fix
Ensure the input key in valohai.yaml matches exactly: e.g., inputs: [name: dataset] then code uses ctx.inputs['dataset'].
Upgrade
Version history
0.7.0latest on PyPI · released Mar 21, 2025
Audit
Dependencies
valohairequiredCore client library for Valohai API interactions
clickoptionalCommand-line interface framework
Agent activity
26 hits · last 30 days
node
22
OpenAI (training)
1
Resources
valohai-utils — pip install valohai-utils · libregistry