Rework the documentation for poetry manager #28242
ddluke
started this conversation in
Suggest an Idea
Replies: 1 comment 1 reply
-
This flow would be better:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Tell us more.
Hi folks! First, I want to say that Renovate is a great tool, and it helped us a lot in our distributed repository stack
to automate dependency updates for a lot of use cases (terraform providers, docker image versions, GitHub action
versions and a lot more) 🚀 💪
However, we still have not adopted Renovate for any of our poetry managed python projects (albeit we would like to) due
to:
And I do see that there might be a general misconception of what Renovate should do with poetry managed python projects,
and what Renovate should or must not do. I want to say that I'm not a contributor of poetry myself, but I do have
roughly a decade python programming experience in diverse distributed cloud stacks and am a user of poetry since roughly
4-5 years.
There are a handful of notes in the Renovate docs that heavily irritate me, perhaps you could clarify these or rework the documentation?
In essence, what confuses me the most is actually all contained in this section of the documentation.
Complexity of dependency graphs
This is because dependency graphs are complex, and poetry respects the fact that this is the case. An update to 7.4.3
might as well just completely break the library or application, and if poetry refuses to update the dependency to 7.4.3
than this is probably for good reasons. One example could be that any of potentially hundreds of different and partially
interconnected dependencies in the dependency tree of the library may be marked as incompatible with 7.4.3. Naively or
forcefully updating the dependency to 7.4.3 in that case might completely break the application or library since it
becomes uninstallable.
Obviously, also poetry may contain bugs, but in general, if poetry refuses to choose version 7.4.3, one should accept that this is for good reasons.
Library vs Application Code
This is bad practice! Or at least it depends on whether the project contains library or application code. For
application code, this statement might make sense, since you really want to be sure that your code is deployed and
shipped with a deterministic dependency set. However, this is why lock files exist (poetry.lock)! Pinning dependencies
as general advice in the pyproject.toml file is bad even for application code. This is why you use lock files.
In fact, I would say that there are only a handful of cases where pinning dependencies for application code might make
sense:
namespace collision exploits when using multiple repository sources (e.g. PyPI + an additional private index)
library (e.g. apache-airflow in AWS MWAA or GCP Cloud Composer, or apache-spark in AWS Glue)
For library code, this statement makes no sense at all. If every python library out there would follow this advice, then
no library would be installable anymore. The pyproject.toml is not a lock file, it contains package metadata. For
library code, you want to make sure that a downstream user of the library is give the freedom to pick a range of
versions of a given dependency, to avoid dependency clashes with other dependencies. If one would follow the advice of
Renovate for library code, and, to stick with the example, pin coverage to version 7.4.3, then every downstream library
would be forced to use this exact same version as well.
This is why, for library code, you usually don't want to pin dependencies to patch level. As a best practice, you
instead specify a range of versions that your library is compatible with, you add good coverage for these supported
versions, and allow a downstream consumer of your library to pick one of the supported dependency versions.
In fact, I wonder if Renovate should touch a pyproject.toml file at all, or if, then probably only for an explicit
configurable allow list (since it's obviously impossible for Renovate to differentiate between library and application
code).
Missing documentation on the picked poetry version
This is another thing that worries me. When I tested Renovate on some of our projects, I do constantly see changes like
these in lock files:
This indicates that Renovate uses a version of poetry that differs from the version the lock file was generated with.
Could you please update the documentation to explain how the poetry version is chosen?
Beta Was this translation helpful? Give feedback.
All reactions