python-poetry / python-poetry/poetry

Could we strictly install from a poetry.lock file?

Open
#4,097 2 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

Is it possible to create a poetry install option that only installs from a poetry.lock file and fails if it cannot be found?

A poetry.lock file was accidentally deleted in one of my projects and it didn't cause CI to break. But when other developers tried to install the project, it took them a really long time to run poetry install because it wasn't reading from a lock file anymore and doing all the dependency management from scratch. In the future, we'd like to catch these mistakes automatically, so it would be awesome to have something that behaves like this:

$ ls | grep poetry.lock
poetry.lock

$ poetry install --from-lock
... (success)

$ rm poetry.lock

$ poetry install --from-lock
ERROR: poetry.lock was not found

A workaround is pretty trivial, but it would be cool if it was supported out-of-the-box 😄

if [ ! -e poetry.lock ]; then
    echo "poetry.lock file not found. aborting installation" >2
    exit 1
fi

poetry install

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation of the poetry install command and its existing lock-file handling. Check how the command behaves when poetry.lock is absent, then add and test an option that fails in that case while continuing to install from the lock file when present.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.