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

feat: expose 'pip_utils.normalize_name' function #1542

Merged
merged 7 commits into from
Nov 9, 2023

Conversation

aignas
Copy link
Collaborator

@aignas aignas commented Nov 7, 2023

With this change users can use a previously private function to normalize a
PyPI package name into something that bazel can use.

Copy link
Contributor

@rickeylev rickeylev left a comment

Choose a reason for hiding this comment

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

Can you also:

  • Add a comment on the all_whl_requirements_by_package line that pip_utils.normalize_name() should be used to construct the correct key

python/private/bzlmod/requirements.bzl.tmpl Outdated Show resolved Hide resolved
@aignas aignas marked this pull request as ready for review November 8, 2023 13:10
@aignas aignas requested a review from alexeagle November 8, 2023 13:23
@@ -331,13 +333,13 @@ def _pip_repository_impl(rctx):
for p in bzl_packages.values()
]),
"%%ALL_WHL_REQUIREMENTS_BY_PACKAGE%%": _format_dict(_repr_dict({
name: macro_tmpl.format(p, "whl")
normalize_name(name): macro_tmpl.format(p, "whl")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note: as an alternative, you could revert this change that I made:
78fc4de#diff-bced444149cf9f25b36837efb2792070f362650b01f553d9d01bef080ebfefabL279-R279
which was only to preserve the original user-provided name.

If you revert that, then bzl_packages becomes just a list of normalized names again, and you wouldn't need to normalize it here.

This may be better just to simplify the code, now that we have no need for bzl_packages to be a map.

@alexeagle alexeagle added this pull request to the merge queue Nov 9, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 9, 2023
@rickeylev rickeylev added this pull request to the merge queue Nov 9, 2023
Merged via the queue into bazelbuild:main with commit 9facc3e Nov 9, 2023
3 checks passed
@aignas aignas deleted the feat/expose_normalize_name branch May 13, 2024 06:49
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.

3 participants