Skip to content

Return install record mismatches from install()#328

Open
dimbleby wants to merge 1 commit into
pypa:mainfrom
dimbleby:install-record-validation
Open

Return install record mismatches from install()#328
dimbleby wants to merge 1 commit into
pypa:mainfrom
dimbleby:install-record-validation

Conversation

@dimbleby
Copy link
Copy Markdown
Contributor

@dimbleby dimbleby commented Apr 4, 2026

have install() return a list of (source_record, installed_record) tuples for files whose hash or size differs from the wheel's RECORD. Callers that don't care can ignore the return value (previously None).

Alternative approach to #327, allowing installers to detect (most) errors in only a single pass over large files. They would

  • validate_record(validate_contents=False)
  • install() and pay attention to reported mismatches.

This is not perfect

  • RECORD that is wrong for scripts gets missed, because installer rewrites scripts during install
    • callers who want to be more careful can still call validate_record()
  • RECORD that uses an algorithm other than one of the blessed few is not checked
    • again validate_record() is still available.
  • I do not love the manipulation of Destination.hash_algorithm, but it would be a breaking change to pass this through more cleanly as a parameter.
    • You have just gone 1.0, I speculate that you might feel it is too soon for a 2.0

But it covers most things in an efficient way.

Maintainers will need to take a view on whether this is a reasonable set of trade-offs or not.

@dimbleby dimbleby force-pushed the install-record-validation branch 2 times, most recently from ee7eebf to a3d7679 Compare April 4, 2026 13:47
install() now returns a list of (source_record, installed_record) tuples
for files whose hash or size differs from the wheel's RECORD.  Callers
that don't care can ignore the return value (previously None).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dimbleby dimbleby force-pushed the install-record-validation branch from 3fd787d to 5225ec8 Compare April 4, 2026 13:52
@Secrus
Copy link
Copy Markdown
Member

Secrus commented Apr 16, 2026

@pradyunsg I would like your input on that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants