Skip to content

feat: expose 'pip_utils.normalize_name' function#1542

Merged
rickeylev merged 7 commits intobazel-contrib:mainfrom
aignas:feat/expose_normalize_name
Nov 9, 2023
Merged

feat: expose 'pip_utils.normalize_name' function#1542
rickeylev merged 7 commits intobazel-contrib:mainfrom
aignas:feat/expose_normalize_name

Conversation

@aignas
Copy link
Copy Markdown
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.

@aignas aignas force-pushed the feat/expose_normalize_name branch from 80fc54d to cdeb5d8 Compare November 7, 2023 14:14
Copy link
Copy Markdown
Collaborator

@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

@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
]),
"%%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
Copy Markdown
Contributor

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 bazel-contrib:main with commit 9facc3e Nov 9, 2023
@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