specification: make is_same_package_as() commutative and …#325
Conversation
1f86fd1 to
27ebf1e
Compare
|
Even though the current behavior is clearly incorrect (because not commutative), this change might be too risky without further investigation. It's very likely, that in some cases the behavior as proposed in this PR is desired, but in other cases a less strict behavior à la "package is the same if name is the same" is required (see python-poetry/poetry#5617 for example). These cases have to be identified and fixed before fixing |
|
@abn Since you had some concerns about this change influencing the behavior of the installer, I investigated that a bit. This should be the relevant part in the code: https://github.com/python-poetry/poetry/blob/80b03ece039ec72e86d87295ea557a4282891bd9/src/poetry/puzzle/transaction.py#L45-L51 It's obvious that there is a special handling if PyPI dependencies (no source_type) and legacy dependencies are involved. Given the version is equal, I investigated the relevant combinations:
* Special case is necessary because when installing a package with I assume the missing update when switching from direct to pypi is a real bug. The missing update when switching between pypi and legacy may be desired (though I'm not sure if it is sensible). If it is desired it should be handled directly in the linked spot and not partially relying on a weird behavior of By the way, due to What do you think? |
…n False if source_types do not match
27ebf1e to
2455144
Compare
|
I did some further investigations. It seems an installed package is never of type legacy. That's just not tracked. If you install a package with |
|
Kudos, SonarCloud Quality Gate passed!
|
Thanks for looking into this! Given your investigation, I am pretty comfortable merging this, especially as we want to get a beta out. 🎉 |
|
@radoering thanks again for digging into this. Just voicing that I am in agreement with @neersighted here. We can deal with any fall out in the lead upto poetry |
|
Code documentation may be enough because the situation simplifies with the fix in this PR. |








always return False if source_types do not match
Fixes an issue where
p1.is_same_package_as(p2)returnsTrue, butp2.is_same_package_as(p1)returnFalse.