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 --lockCommon 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 --lockRelated guides
poetry install: Install from the LockfileHow poetry install resolves and installs dependencies from poetry.lock, the --no-root and --only flags useful…
poetry update: Upgrade Within ConstraintsHow poetry update upgrades dependencies to the newest versions allowed by pyproject.toml, updates the lock, a…
poetry export: Export to requirements.txtHow poetry export converts the lockfile to a requirements.txt for pip stages, the hashes and groups flags, an…