python-poetry / python-poetry/poetry

Insufficient cache invalidation after Poetry upgrade causes lockfile diffs

Open
#7,224 2 comments 0 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

  • Poetry version: 1.3.1
  • Python version: 3.11.1
  • OS version and name: Linux & macOS
  • pyproject.toml: (empty)
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.

Issue

I understand it must be convenient to close bugs, pretend they don't exist and ignore any follow-up comments like in #7207. But I spent at least two hours debugging this, so it would be a shame to lose this effort.

When I first install pynacl with Poetry 1.2, then upgrade to Poetry 1.3.1 and install the same package, the lockfile differs from what a fresh Poetry 1.3.1 installation would produce.

You can try these commands for example with Docker docker run -it --rm python:3.11.1 bash

Fresh installation
mkdir test
cd test
pip install poetry==1.3.1
poetry init -n
poetry add pynacl

Output:

root@f283c78a5680:/test# grep sphinx poetry.lock
docs = ["sphinx (>=1.6.5)", "sphinx-rtd-theme"]
Upgraded installation
mkdir test
cd test
pip install poetry==1.2.2
poetry init -n
poetry add pynacl
grep sphinx poetry.lock
rm poetry.lock

pip install poetry==1.3.1
poetry --version
poetry lock
grep sphinx poetry.lock

Output:

root@c14aa5d02d26:/test# grep sphinx poetry.lock
docs = ["sphinx (>=1.6.5)", "sphinx_rtd_theme"]
Workaround

The issue can be worked around with poetry cache clear --all .

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

Reproduce the fresh and upgraded installations using the Docker command and Poetry versions in the issue, comparing pyproject.toml and poetry.lock after adding pynacl. Start by investigating Poetry's cache behavior around poetry lock and poetry cache clear --all; done means upgraded installations produce the same lockfile as fresh installations without the workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.