python-poetry / python-poetry/poetry

Up-to-date packages are re-installed if virtualenvs.create is false

Open
#4,358 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Re-opening #4254, which was closed wrongly, #4329 does not fix this bug.

  • I am on the latest current master (22c3aaddc20ad74d3633738093f685fd6dbb998a) Poetry version.

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

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: Ubuntu 20.04

  • Poetry version: current master (22c3aaddc20ad74d3633738093f685fd6dbb998a) (also tested with version 1.2.0a2)

  • Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/jstriebel/6e804c769e2075be390496e68474a36c

Issue

Packages that were already installed (by poetry itself) are re-installed if virtualenvs.create is false. This bug only appears on v1.2, it does not occur on the 1.1 branch or the latest v1.1 releases. I added a reproducible case via a Dockerfile in the linked gist.

When running docker build . on those files, this produces:

Step 12/14 : RUN poetry install
 ---> Running in 73dfd5dcf683
Skipping virtualenv creation, as specified in config file.
Installing dependencies from lock file

Package operations: 3 installs, 0 updates, 2 removals

  • Removing importlib-metadata (4.6.1)
  • Removing zipp (3.5.0)
  • Installing attrs (21.2.0)
  • Installing pyrsistent (0.18.0)
  • Installing jsonschema (3.2.0)
Removing intermediate container 73dfd5dcf683
 ---> 04e982ae2043
Step 13/14 : RUN echo SECOND INSTALL!!!
 ---> Running in 7ec46c74fa47
SECOND INSTALL!!!
Removing intermediate container 7ec46c74fa47
 ---> eff9efcdee5e
Step 14/14 : RUN poetry install
 ---> Running in a877dc9c4864
Skipping virtualenv creation, as specified in config file.
Installing dependencies from lock file

Package operations: 3 installs, 0 updates, 0 removals

  • Installing attrs (21.2.0)
  • Installing pyrsistent (0.18.0)
  • Installing jsonschema (3.2.0)
Removing intermediate container a877dc9c4864

The packages are not installed twice if virtualenvs.create is true (tested by commenting out the COPY poetry.toml / line).

Possibly related previous issues: #1711, #1882 (solved in previous releases, but re-introduced in v1.2)

Given that this was broken multiple times in different ways now, and was not fixed by #4329 as intended, would it be possible to add some tests for this case as well? I'd be happy to help here, but have no experience with the poetry code-base.

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 reproducing the Dockerfile case from the linked gist with virtualenvs.create set to false, comparing the first and second poetry install runs. Read the linked issues #4254 and #4329, then add coverage for the repeated-install behavior and verify that already installed packages are not reported as installs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.