Skip to content

Fix hashes should be hex not base64#250

Merged
danyeaw merged 5 commits intomainfrom
fix-conda-hash
Feb 25, 2026
Merged

Fix hashes should be hex not base64#250
danyeaw merged 5 commits intomainfrom
fix-conda-hash

Conversation

@danyeaw
Copy link
Member

@danyeaw danyeaw commented Feb 23, 2026

Description

Closes #249.

Wheel RECORD includes the hash value as a base64 encoded value per PEP 376 and updated in the Python Package User Guide which includes hash algorithm followed by the equals character =, followed by the urlsafe-base64-nopad encoding of the digest with trailing = removed.

When unpacking an archive, conda creates metadata for each package in its conda-meta/<package.json> file in the paths_data section. The format of this hash is a hex value (the standard sha256sum format) of the sha256 for the sha256 and sha256_in_prefix fields.

The wheel package extractor was taking the hashes from the wheels RECORD and putting it in to the conda metadata directly while unpacking the .whl. This resulted in base64 hashes to appear in conda metadata and resulted in a ValueError when conda-rattler-solver tried to transform the hashes from a conda prefix record to a rattler prefix record.

Since we were also computing hashes in the build module, I centralized the hash calculations in to the utils module and added unit tests for them.

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 23, 2026

Merging this PR will not alter performance

✅ 5 untouched benchmarks


Comparing fix-conda-hash (494f85b) with main (43b0aea)

Open in CodSpeed

@danyeaw danyeaw marked this pull request as ready for review February 23, 2026 15:41
@danyeaw danyeaw requested a review from a team as a code owner February 23, 2026 15:41
Copy link
Contributor

@ForgottenProgramme ForgottenProgramme 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 creating this, @danyeaw.
I looked through the PR and I find some of the tests redundant. Added comments pointing those out.

Copy link
Contributor

@ForgottenProgramme ForgottenProgramme left a comment

Choose a reason for hiding this comment

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

LGTM!
Suggestions made by other reviewers are all relevant and can be tracked in different tickets. 👍🏼

@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Approved in 🔎 Review Feb 25, 2026
@danyeaw danyeaw merged commit 33530c6 into main Feb 25, 2026
37 checks passed
@danyeaw danyeaw deleted the fix-conda-hash branch February 25, 2026 16:46
@github-project-automation github-project-automation bot moved this from ✅ Approved to 🏁 Done in 🔎 Review Feb 25, 2026
@danyeaw danyeaw mentioned this pull request Mar 2, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 🏁 Done

Development

Successfully merging this pull request may close these issues.

conda-rattler solver crashes after first successful install from conda-pypi-test channel

5 participants