-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
-
Poetry version: 1.6.1
-
Python version: 3.11.4
-
OS version and name: Ubuntu 22.04
-
pyproject.toml: Not relevant
-
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
When generating the lockfile, Poetry stores its own version in the @generated
comment at the top of the lockfile. This was added in #7339.
The issue is that this comment is updated by Poetry only when there are changes to the lockfile other than the version used to generate it. That is: if I run poetry lock --no-update
with Poetry 1.6.1, then change manually the comment at the top of the lockfile to say version 1.5.1, then run again poetry lock --no-update
, the comment won't be updated, it will still say Poetry 1.5.1
.
That's because in this function, do_write
is False
if all the metadata is equal but the @generated
comment is different. In turn, that's due to TOMLKit effectively ignoring (top-level?) comments when comparing documents.
If, for instance, I manually alter the content-hash
of the lockfile to something different and then run poetry lock --no-update
, the lockfile will be refreshed and the comment at the top updated to say Poetry 1.6.1.
.
My expectation would be that the comment at the top of the lockfile would still be refreshed even if it's the only change, when running poetry lock --no-update
.
If there's an agreement in favour of this change I'd be happy to try putting a PR together.