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

Implement PEP 753: "Well-known Project URLs in Metadata" #13135

Open
ichard26 opened this issue Dec 29, 2024 · 5 comments
Open

Implement PEP 753: "Well-known Project URLs in Metadata" #13135

ichard26 opened this issue Dec 29, 2024 · 5 comments
Labels
C: list/show 'pip list' or 'pip show' good first issue A good item for first time contributors to work on PEP implementation Involves some PEP state: awaiting PR Feature discussed, PR is needed

Comments

@ichard26
Copy link
Member

A few months ago, PEP 753 was accepted. It is now known as the "Well-known Project URLs in Metadata" standard. We should implement it as pip does consume project URL metadata.

I haven't looked at pip's existing Project-URL or Home-page handling, so it's possible that there is very little or nothing to do on pip's end, but I wanted to file this issue to make sure we take a look at some point. The logic that mirrors PyPI's old homepage Project-URL aliasing probably needs a some tweaking to have it conform to the specification.

if not homepage:
# It's common that there is a "homepage" Project-URL, but Home-page
# remains unset (especially as PEP 621 doesn't surface the field).
#
# This logic was taken from PyPI's codebase.
for url in project_urls:
url_label, url = url.split(",", maxsplit=1)
normalized_label = (
url_label.casefold().replace("-", "").replace("_", "").strip()
)
if normalized_label == "homepage":
homepage = url.strip()
break

cc @woodruffw

@ichard26 ichard26 added C: list/show 'pip list' or 'pip show' PEP implementation Involves some PEP labels Dec 29, 2024
@woodruffw
Copy link
Member

Thanks for pinging me @ichard26!

it's possible that there is very little or nothing to do on pip's end

Indeed 🙂 -- pip shouldn't have to change anything, since PEP 753 stipulates only presentation behavior for indices and (very soft) changes to metadata production for build backends/metadata producers.

@ichard26
Copy link
Member Author

Hmm, I was under the impression that there may be some work on pip's end because pip does consume and show project URLs. I included a link to the code in the issue description. Is that logic PEP compliant?

@woodruffw
Copy link
Member

Ah yeah, my bad -- I forgot that we relaxed the language in the PEP to be any metadata consumer, not just indices.

The current logic looks like it needs to be updated (as does PyPI's -- I haven't done that yet). The PEP's label normalization logic is here: https://peps.python.org/pep-0753/#label-normalization. That should result in a strict superset of results as the current normalization logic.

@ichard26 ichard26 added good first issue A good item for first time contributors to work on state: awaiting PR Feature discussed, PR is needed labels Jan 21, 2025
@ichard26
Copy link
Member Author

ichard26 commented Jan 21, 2025

Ah, that seems very easy. I'll put this on my to-do list, but of course, no promises I'll get to it. And definitely not soon... Thanks for confirming my suspicions!

@woodruffw
Copy link
Member

No problem, sorry for the false lead!

FWIW, this spurred me into doing the first bits on Warehouse as well: pypi/warehouse#17470

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: list/show 'pip list' or 'pip show' good first issue A good item for first time contributors to work on PEP implementation Involves some PEP state: awaiting PR Feature discussed, PR is needed
Projects
None yet
Development

No branches or pull requests

2 participants