Skip to content

Installation

hlock ships as a Python package with a compiled Rust core. Prebuilt wheels cover:

Platform Architectures
Linux (manylinux) x86_64, aarch64
macOS arm64 (Apple silicon), x86_64 (Intel)
Windows x64

One wheel per platform covers CPython 3.9 and newer (abi3). On other platforms, pip builds from the source distribution, which needs a Rust toolchain.

Install the CLI and Python package

pip install hlock
uv add hlock            # add to a project
uv tool install hlock   # or install the CLI globally
uvx hlock --help
pipx install hlock

Check that it worked:

$ hlock --version
hlock, version 0.1.2

hlock works with Claude Code, Codex, Pi, OpenCode, Cursor, Gemini CLI and more; see Supported harnesses.

Teach your agent hlock

The hlock repository ships an Agent Skill, skills/hlock, that tells your agent which hlock command does what, what to check before running one, and where in these docs to find answers. Add it like any other skill:

hlock add skill github:unionai-oss/hlock/skills/hlock

This installs it into the project (.claude/skills/hlock for Claude Code) and pins the commit in harness.lock. Without a ref it follows main. Add a tag or range after @ to follow releases instead (see Declaring dependencies).

harness-lock is an alias for hlock

harness-lock is published as an alias: each release pins the identical hlock release, so installing either name gives you the same hlock (and harness-lock) command and the same API. import hlock and import harness_lock are interchangeable. These docs use hlock everywhere.

Upgrading from 0.1.2 or earlier with pip

Through 0.1.2 the roles were reversed: harness-lock was the package and hlock the alias. Both the old harness-lock and the new hlock contain the harness_lock module, so pip install -U harness-lock in an existing 0.1.2 environment can leave harness_lock half removed (import harness_lock then fails with an ImportError). Reinstall cleanly instead:

pip uninstall -y harness-lock hlock && pip install hlock

uv upgrades in place without this problem.

Optional extras

Extra Install Adds
flyte pip install "hlock[flyte]" The Flyte SDK (flyte) and flyteplugins-rs (for Rust-backed tasks), so the flyte backend can run work as Flyte tasks. The open SDK reaches OSS Flyte and a hosted Union tenant alike; flyteplugins-union is not needed

The worker that runs heavy tuning stages (local and flyte backends) imports pandas/polars, torch/peft/trl, and flyte lazily, and only when a stage needs them. Install those in the worker's environment when you use the stages that need them; see Backends.

Use it from Rust

The core library is published on crates.io as hlock:

cargo add hlock

hlock (and its alias crate, harness-lock) re-export harness-lock-core. See the Rust API reference for an example and the key types.

Build from source

See Development.