Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make RequirementSummary equality and hash unsentive to version format variation #1194

Merged

Conversation

vphilippon
Copy link
Member

Fixes #1192

packaging.specifiers.SpecifierSet (ireq.specifier) provides equality and
hash definition that are based on a canonical specifier representation.

Basing RequirementSummary equality and hash on those allows to easily
side-step any version/specifier normalization concerns on our side.

Effectively, makes equality and hash of
test_package==1.2.0 and test_package==1.2 to be the same, as expected.

Changelog-friendly one-liner: Fix pip 20.2 compatibility issue that caused pip-tools to sometime fail to stabilize in a constant number of rounds.

Contributor checklist
  • Provided the tests for the changes.
  • Gave a clear one-line description in the PR (that the maintainers can add to CHANGELOG.md on release).
  • Assign the PR to an existing or new milestone for the target version (following Semantic Versioning).

@vphilippon vphilippon added bug fix resolver Related to dependency resolver labels Jul 30, 2020
@vphilippon vphilippon added this to the 5.3.1 milestone Jul 30, 2020
@vphilippon
Copy link
Member Author

vphilippon commented Jul 30, 2020

Argh, forgot to check with pip<20.2 before submitting 🤦‍♂️ .
I'll look if there's a way to easily fix that across the board.

Alternatively, we can drop the older pip versions as per our new policy, right?

@vphilippon
Copy link
Member Author

I locally tested, and the new code actually works with pip 20.0, 20.1 and 20.2.

But only pip 20.2 has the updated vendored packaging version such that the canonical SpecifierSet is used for equality and hashing.
But it's also only with pip 20.2 that pip-tools needs that enhanced equality/hash on RequirementsSummary.

So I should be able to put a condition mark on some specific test case, and this should be good.

@vphilippon vphilippon force-pushed the improve-RequirementSummary-eq-and-hash branch from 1d8984c to b8bb170 Compare July 30, 2020 21:20
… variation

`packaging.specifiers.SpecifierSet` (`ireq.specifier`) provides equality and
hash definition that are based on a canonical specifier representation.

Basing RequirementSummary equality and hash on those allows to easily
side-step any version/specifier normalization concerns on our side.

Effectively, makes equality and hash of
`test_package==1.2.0` and `test_package==1.2` to be the same, as expected.
@vphilippon vphilippon force-pushed the improve-RequirementSummary-eq-and-hash branch from b8bb170 to 0dad94e Compare July 30, 2020 21:29
Copy link
Member

@atugushev atugushev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome 🎉 I've tested with this reproducer locally — it works.

@atugushev
Copy link
Member

atugushev commented Jul 31, 2020

@vphilippon

Alternatively, we can drop the older pip versions as per our new policy, right?

Yeah, there is a #1191 to drop pip-20.0.

@atugushev atugushev merged commit ed59c36 into jazzband:master Jul 31, 2020
@atugushev
Copy link
Member

Thanks @vphilippon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolver Related to dependency resolver
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pip 20.2 incompatibility
2 participants