Skip to content
Latchkey

uv lock: Resolve and Write uv.lock

Produce a cross-platform lockfile without installing.

uv lock resolves the dependencies declared in pyproject.toml and writes a universal uv.lock, without installing them. Commit the lock so every runner resolves identically.

What it does

Computes a full resolution and writes uv.lock. Flags control upgrades (--upgrade, --upgrade-package) and verification (--check fails if the lock is out of date).

Common usage

Terminal
uv lock
uv lock --check
uv lock --upgrade
uv lock --upgrade-package requests

Common CI gate: assert the lock is current

Use uv lock --check as a CI gate: it exits non-zero when uv.lock does not match pyproject.toml, catching a forgotten re-lock before merge.

Terminal
# CI gate - fail if lock is stale:
uv lock --check

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →