Question
Poetry.lock vs pyproject.toml: Safe rollback after schema change?
Dev Lane
0 reputation · 08 Feb 2021, 19:18 UTC
71.4K views0
Integration between Poetry.lock and pyproject.toml
The goal is to revert a project to a known good dependency state after the schema in pyproject.toml has been altered. In practice, this means restoring an older poetry.lock and invoking poetry install to re‑install the exact package hashes recorded in that lockfile.
Key constraints:
- Poetry 1.x and 2.x use different resolver algorithms; a lockfile that was valid under one may be rejected by the other.
- Modifying dependency constraints in
pyproject.tomlwithout re‑runningpoetry lockcan leave the resolver in a partially resolved state. - Running
poetry installafter replacing the lockfile may triggerResolutionImpossibleerrors if the newer constraints conflict with the old lockfile.
Unresolved questions:
- Does restoring an older
poetry.lockand runningpoetry installalways re‑establish the exact environment, regardless of the Poetry version? - How does the 2.x resolver handle previously valid lockfile combinations when
pyproject.tomlhas been updated? - Is there a documented, safe sequence of commands that guarantees rollback integrity after schema changes?