4

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?

4
  • 1
    Did you update poetry in between (or using 2 different versions to generate the 2 lock files)?
    – sinoroc
    Jan 8, 2021 at 9:05
  • 1
    Potentially relevant: maybe don't commit the lockfile
    – Arne
    Jan 8, 2021 at 15:40
  • @Arne is right, unless your project is an application. My rule is: if it's not an application (i.e. it's a library, plug-in, etc.), then don't commit the lock file, or the frozen requirements.txt, or pinned dependencis in general; if it's an application then it could make sense to commit the lock file.
    – sinoroc
    Jan 8, 2021 at 17:14
  • The project is an application.
    – hans
    Sep 15, 2021 at 8:30

1 Answer 1

2

Solution

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

1
  • 1
    My assumption, is that from now on and with all following poetry releases, the content of the lock file should be expected to be stable (no change in the ordering). If not then it should probably raised as a bug. Meaning there should be no need to version poetry itself. -- Some poetry versioning might still be in the works though, and if I am not mistaken the lock files themselves are already versioned . -- Feel free to ask here for confirmation from the maintainers: github.com/python-poetry/poetry/discussions
    – sinoroc
    Jan 8, 2021 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.