python-poetry / python-poetry/poetry

`poetry lock --check` doesn't warn of missmatch in versions of local dependencies and their transitive dependencies

Open
#8,205 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

  • 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.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

Consider the following project structure:

|- A
|  |- a
|  |  |- __init__.py
|  |  |- ...
|  |
|  |- pyproject.toml
|
|- B
|  |- b
|  |  |- __init__.py
|  |  |- ...
|  |
|  |- pyproject.toml

and B depends on A (see gist for pyproject.toml content).

B's poetry.lock also contains packages A depends on (so not directly stated in B's pyproject.toml), but if a A changes a version of its dependency, running poetry lock --check --directory B will not register that the lockfile is not consistent anymore. However, running poetry lock --no-update --directory B will change the lockfile.

The same happens in case A bumps its version

Expected output

In this case I'd expect poetry lock --check --directory B to report the inconsistency, i.e. lock --check should pass only if lock --no-update would not make any changes.

Full example for transitive dependencies

Full example starting from the pyproject.toml from the gist:

>> poetry lock --directory A
Updating dependencies
Resolving dependencies... (0.3s)

Writing lock file

>> poetry lock --directory B
Updating dependencies
Resolving dependencies... (0.3s)

Writing lock file 

>> poetry add "plotly@<5.15" --directory A
Updating dependencies
Resolving dependencies... (0.1s)

Package operations: 3 installs, 0 updates, 0 removals

 • Installing packaging (23.1)
 • Installing tenacity (8.2.2)
 • Installing plotly (5.14.1)

Writing lock file

>> poetry lock --check --directory A      
poetry.lock is consistent with pyproject.toml.

>> poetry lock --check --directory B      
poetry.lock is consistent with pyproject.toml.

>> poetry lock --directory B        
Updating dependencies
Resolving dependencies... (0.2s)

Writing lock file

diff in B's lockfile: gist
TL;DR the entry for package a changed and the entry for plotly changed to downgrade the version.

Full example for local dependency version bump

Full example starting from the pyproject.toml from the gist:

>> poetry lock --directory A
Updating dependencies
Resolving dependencies... (0.3s)

Writing lock file

>> poetry lock --directory B
Updating dependencies
Resolving dependencies... (0.3s)

Writing lock file 

>>  poetry version patch --directory A
Bumping version from 0.1.0 to 0.1.1

>> poetry lock --check --directory A      
poetry.lock is consistent with pyproject.toml.

>> poetry lock --check --directory B      
poetry.lock is consistent with pyproject.toml.

>> poetry lock --directory B        
Updating dependencies
Resolving dependencies... (0.2s)

Writing lock file

diff in B's lockfile:

before:

[[package]]
name = "a"
version = "0.1.0"
description = ""
optional = false
python-versions = "^3.10"
files = []
develop = true

after:

[[package]]
name = "a"
version = "0.1.1"
description = ""
optional = false
python-versions = "^3.10"
files = []
develop = true

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 issue with A/pyproject.toml, B/pyproject.toml, and B/poetry.lock using the documented poetry lock --check --directory B and poetry lock --no-update --directory B commands. Compare the lockfile before and after changing A’s dependency or version, then verify that the check reports inconsistency whenever the no-update command changes B/poetry.lock.

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
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.