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 requestsCommon 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 --checkRelated guides
uv sync: Install Exactly What uv.lock PinsHow uv sync makes the environment match uv.lock exactly, the --frozen and --no-dev flags for CI, and the lock…
uv pip compile: Generate a Pinned requirements.txtHow uv pip compile turns requirements.in into a fully pinned requirements.txt, the --generate-hashes flag, an…
poetry lock: Resolve and Write poetry.lockHow poetry lock resolves dependencies and writes poetry.lock without installing, the --no-update flag, and th…