Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make poetry respect field order in poetry.lock

Context

We use poetry to track dependencies in our python project. We commit poetry.lock into git.

I added recently one package with poetry add. But then in diff I observed that poetry changed order to fields in the whole file generating a huge useless diff:

diff

It goes like this for the whole lock file. Its main drawback is generation of conflicts when trying to merge.

Question

How can I force poetry to use existing order of fields? Or what other solution do you propose to this problem?

like image 685
hans Avatar asked Sep 16 '25 14:09

hans


2 Answers

Solution

Use the same poetry version by all team members. Apparently poetry does not version... poetry ;)

like image 146
hans Avatar answered Sep 18 '25 09:09

hans


Poetry diffs are often hard to make sense of. To keep track of what your dependencies are I have written a Github Action that will post a nicely readable summary of all changes to your pull requests. Maybe you will find this helpful: https://github.com/marketplace/actions/diff-poetry-lock

like image 25
Nils Borrmann Avatar answered Sep 18 '25 08:09

Nils Borrmann