Skip to content
Latchkey

poetry lock: Resolve and Write poetry.lock

Produce a deterministic lockfile without installing anything.

poetry lock resolves the dependency graph and writes poetry.lock, without installing packages. CI commits the lock so every machine resolves to identical versions.

What it does

Computes a full, pinned resolution from pyproject.toml and writes poetry.lock. With --no-update it refreshes the lock to match pyproject.toml without upgrading already-locked packages.

Common usage

Terminal
poetry lock
poetry lock --no-update
poetry check --lock

Common CI gate: verify the lock is current

A common CI gate fails the build when the committed lock does not match pyproject.toml. Use "poetry check --lock" to assert consistency without resolving everything from scratch.

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

Related guides

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