Skip to content
Latchkey

poetry lock: Resolve the Lockfile Command Reference

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.

Common flags / usage

  • poetry lock -- resolve and write poetry.lock
  • --no-update -- refresh the lock to match pyproject.toml without upgrading
  • poetry check --lock -- assert the lock matches pyproject.toml

Example

shell
# CI gate: fail the build if the committed lock is stale
- run: poetry check --lock

In CI

Use "poetry check --lock" as a fast gate that fails when poetry.lock does not match pyproject.toml, without resolving everything from scratch. This catches a forgotten re-lock before merge.

Key takeaways

  • poetry lock writes a pinned resolution without installing.
  • --no-update refreshes the lock without upgrading existing pins.
  • poetry check --lock is a cheap staleness gate for CI.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →