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(py_wheel): Add support for specifying Project-URL in METADATA #1276

Merged
merged 2 commits into from
Jun 19, 2023

Conversation

sfc-gh-wzhao
Copy link
Contributor

@sfc-gh-wzhao sfc-gh-wzhao commented Jun 17, 2023

Project-URL is a field available in core metadata since version 1.2, which allows specifying additional URLs and display as Project Links in PyPI package web page.

https://packaging.python.org/en/latest/specifications/core-metadata/#project-url-multiple-use

This change adds the support to specify that.

`Project-URL` is a field available in core metadata since version 1.2, which allows specifying additional URLs.

https://packaging.python.org/en/latest/specifications/core-metadata/#project-url-multiple-use

This change adds the support to specify that.
@sfc-gh-wzhao
Copy link
Contributor Author

@sfc-gh-sdas FYI.

Copy link
Collaborator

@chrislovecnm chrislovecnm 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 the PR! See comments.

@@ -301,6 +305,9 @@ def _py_wheel_impl(ctx):
if ctx.attr.summary:
metadata_contents.append("Summary: %s" % ctx.attr.summary)

for label, url in sorted(ctx.attr.project_urls.items()):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please check for the max length of the label. The label is limited to 32 characters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for pointing out. A check has been added, and will fail out if the length is over limit. Corresponding test is also added.

@@ -176,6 +176,10 @@ _other_attrs = {
doc = "A string specifying the license of the package.",
default = "",
),
"project_urls": attr.string_dict(
doc = ("A string dict specifying additional browsable URLs for the project and corresponding labels. " +
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit pick. Mention the key first and the label second. You have them reversed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated with better explanation about the way to specify.

Add a check to the length of the label and fail when it is oversize, with corresponding tests.

Update docs for better instruction on how to specify the label and url.
Copy link
Collaborator

@chrislovecnm chrislovecnm left a comment

Choose a reason for hiding this comment

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

LGTM!

@chrislovecnm chrislovecnm added this pull request to the merge queue Jun 19, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 19, 2023
@chrislovecnm chrislovecnm added this pull request to the merge queue Jun 19, 2023
Merged via the queue into bazelbuild:main with commit 2fb9a2a Jun 19, 2023
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