Repository navigation
Closed
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expected
Description
- I am on the latest 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 (
-vvvoption).
- OS version and name: macOS 10.15.7
- Poetry version: 1.1.5
- Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/martinmo/bf32a5e6278f9edc74eb3f7787e5b372
Issue
When poetry update is called with the --dry-run argument, the expected outcome is that the file poetry.lock remains unmodified.
However, a regression introduced in poetry version 1.1.1 (it seems, via PR #3034) modifies this file regardless of the --dry-run flag.
To reproduce using the above gist:
$ git clone https://gist.github.com/bf32a5e6278f9edc74eb3f7787e5b372.git poetry-bug && cd poetry-bug
$ poetry -V
Poetry version 1.1.5
$ poetry config --list
cache-dir = "/Users/martin/Library/Caches/pypoetry"
experimental.new-installer = false
installer.parallel = false
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/martin/Library/Caches/pypoetry/virtualenvs
$ poetry update --dry-run
Updating dependencies
Resolving dependencies... (0.1s)
Writing lock file
Package operations: 1 install, 0 updates, 0 removals
- Installing defusedxml (0.7.1)
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: poetry.lock
no changes added to commit (use "git add" and/or "git commit -a")
With poetry 1.1.0, it works as expected:
$ git checkout poetry.lock
$ pipx install --suffix @1.1.0 'poetry==1.1.0'
$ poetry@1.1.0 -V
Poetry version 1.1.0
$ poetry@1.1.0 update --dry-run
Updating dependencies
Resolving dependencies... (0.1s)
Package operations: 1 install, 0 updates, 0 removals
- Installing defusedxml (0.7.1)
$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
As of now, poetry's master is also affected. It happens regardless of the experimental.new-installer and installer.parallel settings.
I have already written a unit test to reproduce this and an according fix that I'll submit as a PR in a minute.
Reacted by Matthew Scheifer, ajenkins-cargometrics, Amrish Parmar, Johannes Wienke, 이정민(Jeong-Min Lee) / Merchant, Stanislav Schmidt, Seon82 and Calum Smith
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expected
Activity
justinmayer commentedon Mar 27, 2021
See also: #3739 #3666
languitar commentedon Jun 29, 2021
This is highly annoying in case of merge conflicts in the lock file. Using
poetry lock --no-updatewould be one version to resolve the conflicts, but implicitly changing versions with this command might trigger a cascade of further errors.brettborowski commentedon Jul 12, 2021
Does this also affect
poetry add --dry-runas well?martinmo commentedon Jul 13, 2021
Yes, I would think so, because in addition to the
updatecommand it was also reported that theremoveandlockcommands are affected. This makes sense, as the function_write_lock_file(…)in poetry/installation/installer.py#L335 setsforcetoTrueby default and modifies the lockfile ifforceisTrue. This is what I've changed in my PR (see above).Stannislav commentedon Aug 26, 2021
Bug still present in the latest
Poetry version 1.1.8.zEdS15B3GCwq commentedon Apr 5, 2022
Still present in 1.2.0b1. Please proceed with PR. Much appreciated.
github-actions commentedon Mar 2, 2024
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.