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

Fix --generate-hashes when hashes are computed from files #1540

Merged
merged 2 commits into from Apr 4, 2022

Conversation

RazerM
Copy link
Member

@RazerM RazerM commented Dec 4, 2021

Fixes #1532

This issue only shows up for PyPI servers where we can't get hashes from
a JSON API. When pip-compile runs, find_all_candidates first gets
called outside of an allow_all_wheels() context, and pip caches the
list of candidates. Later, while pip-compile computes hashes from the
files, the effects of allow_all_wheels() are not seen because the
cached candidates are returned.

In order for the test to pass I've added a blank sdist for
small-fake-multi-arch so that there's always at least one candidate
when pypi_repository.get_hashes is called outside of allow_all_wheels

Contributor checklist
  • Provided the tests for the changes.
  • Assure PR title is short, clear, and good to be included in the user-oriented changelog
Maintainer checklist
  • Assure one of these labels is present: backwards incompatible, feature, enhancement, deprecation, bug, dependency, docs or skip-changelog as they determine changelog listing.
  • Assign the PR to an existing or new milestone for the target version (following Semantic Versioning).

@RazerM RazerM requested a review from hramezani January 5, 2022 14:27
@RazerM RazerM added this to the 6.6.0 milestone Feb 19, 2022
@RazerM RazerM added the bug Something is not working label Feb 19, 2022
@RazerM RazerM removed the request for review from hramezani March 18, 2022 17:07
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.

Thanks for the fix! Getting hashes from API released on pip-tools v5.1.0 2020-04-27 and lru_cache() added to PackageFinder.find_all_candidates() on 2020-10-30. That's why the bug was hard to notice. Good catch!

Fixes jazzband#1532

This issue only shows up for PyPI servers where we can't get hashes from
a JSON API. When pip-compile runs, `find_all_candidates` first gets
called outside of an `allow_all_wheels()` context, and pip caches the
list of candidates. Later, while pip-compile computes hashes from the
files, the effects of `allow_all_wheels()` are not seen because the
cached candidates are returned.

In order for the test to pass I've added a blank sdist for
small-fake-multi-arch so that there's always at least one candidate
when pypi_repository.get_hashes is called outside of allow_all_wheels
@atugushev
Copy link
Member

atugushev commented Apr 4, 2022

@RazerM feel free to squash and merge this after ci is green.

@RazerM RazerM merged commit 24ebb83 into jazzband:master Apr 4, 2022
@RazerM RazerM deleted the fix-cached-candidates branch April 4, 2022 16:02
@atugushev atugushev changed the title Fix --generate-hashes when hashes are computed from files Fix --generate-hashes when hashes are computed from files Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generating hashes from files for incompatible wheels isn't working
2 participants