-
Notifications
You must be signed in to change notification settings - Fork 541
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
feat(py_wheel): Add support for specifying Project-URL in METADATA #1276
Conversation
`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-sdas FYI. |
There was a problem hiding this 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()): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
python/private/py_wheel.bzl
Outdated
@@ -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. " + |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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.