python-poetry / python-poetry/poetry
`poetry lock --check` doesn't warn of missmatch in versions of local dependencies and their transitive dependencies
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
- Poetry version: 1.5.1 (curl), also tried installing @main with pipx
- Python version: 3.10
- OS version and name: macOS 12.5
- pyproject.toml: gist
- 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 (
-vvvoption) 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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