feat(py_wheel): Add support for specifying Project-URL in METADATA#1276
Merged
chrislovecnm merged 2 commits intobazel-contrib:mainfrom Jun 19, 2023
Merged
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.
Contributor
Author
|
@sfc-gh-sdas FYI. |
Contributor
chrislovecnm
left a comment
There was a problem hiding this comment.
Thanks for the PR! See comments.
| if ctx.attr.summary: | ||
| metadata_contents.append("Summary: %s" % ctx.attr.summary) | ||
|
|
||
| for label, url in sorted(ctx.attr.project_urls.items()): |
Contributor
There was a problem hiding this comment.
Please check for the max length of the label. The label is limited to 32 characters.
Contributor
Author
There was a problem hiding this comment.
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
| default = "", | ||
| ), | ||
| "project_urls": attr.string_dict( | ||
| doc = ("A string dict specifying additional browsable URLs for the project and corresponding labels. " + |
Contributor
There was a problem hiding this comment.
Nit pick. Mention the key first and the label second. You have them reversed.
Contributor
Author
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Project-URLis 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.