Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Allow METADATA files in pip_repository generated targets #637

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

Merged
merged 1 commit into from
Mar 4, 2022
Merged

Allow METADATA files in pip_repository generated targets #637

merged 1 commit into from
Mar 4, 2022

Conversation

UebelAndre
Copy link
Contributor

@UebelAndre UebelAndre commented Mar 3, 2022

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Currently *.dist-info/METADATA files are excluded in pip_repository generated targets. This is incorrect as it's consumed by https://docs.python.org/3/library/importlib.metadata.html

Issue Number: N/A

What is the new behavior?

This change allows METADATA files to be included in pip_repository generated targets, enabling the use of https://docs.python.org/3/library/importlib.metadata.html.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@UebelAndre UebelAndre marked this pull request as ready for review March 3, 2022 03:02

# Note: `METADATA` is important as it's consumed by https://docs.python.org/3/library/importlib.metadata.html
# `METADATA` is expected to be there to show dist-info files are included in the runfiles.
metadata_path = r.Rlocation("{}/METADATA".format(dist_info_dir))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a restored regression test from #626 but has new meaning as it now uses METADATA files to ensure this isn't removed from the data attributes of generated targets.

@f0rmiga f0rmiga requested a review from mattem March 3, 2022 19:55
@mattem mattem merged commit 79cebad into bazel-contrib:main Mar 4, 2022
@UebelAndre UebelAndre deleted the dist_info branch March 4, 2022 22:03
dist_info_ignores = [
"**/*.dist-info/METADATA",
# RECORD is known to contain sha256 checksums of files which might include the checksums
Copy link

Choose a reason for hiding this comment

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

Are there known examples this happens in? Some import lib functions fail still because they use data from RECORD, the files() method on a distribution for instance.

Copy link
Collaborator

@groodt groodt Jun 1, 2022

Choose a reason for hiding this comment

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

I too have been wondering why we're doing so much non-standard unpacking and exclusion of files from wheel packages.

I'm trying to land a change that uses installer to bring some PEP standards into this rule set. See: #715

I think we need a better way to handle non-determinism. I think we need to either make it opt-in somehow, or direct people in how to use a "wheel only" setup (using --only-binary=:all:). If you do that, then the only non-determinism is generated .pyc files, which can be excluded/included via some parameters.

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.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.