Update PyPi package registry to use project.urls from pyproject.toml #13905

Closed
opened 2025-11-02 10:56:48 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @satr-cowi on GitHub (Jan 2, 2025).

Description

At the moment a link only seems to appear in the pypi package registry for setup.cfg files with a url field, which is translated to a Home-page metadata field. I believe this bit of meta-data has been deprecated recently: https://packaging.python.org/en/latest/specifications/core-metadata/#home-page

I believe the issue may be related to this line (but not fully sure):
9882917bce/routers/api/packages/pypi/pypi.go (L142)

Ideally links would appear in a similar way to that in pypi (Where the [project.urls] table can take homepage, documentation, tracker etc.)

The current documentation on what metadata is available and how it is used could also be heavily improved.

Gitea Version

1.21.11

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

image

Git Version

No response

Operating System

Windows Server

How are you running Gitea?

Running the .exe on a Windows Server

Database

PostgreSQL

Originally created by @satr-cowi on GitHub (Jan 2, 2025). ### Description At the moment a link only seems to appear in the pypi package registry for setup.cfg files with a url field, which is translated to a Home-page metadata field. I believe this bit of meta-data has been deprecated recently: https://packaging.python.org/en/latest/specifications/core-metadata/#home-page I believe the issue may be related to this line (but not fully sure): https://github.com/go-gitea/gitea/blob/9882917bce9d582c9c1ed202d554e4a6d61ed5e4/routers/api/packages/pypi/pypi.go#L142 Ideally links would appear in a similar way to that in pypi (Where the [project.urls] table can take homepage, documentation, tracker etc.) The current documentation on what metadata is available and how it is used could also be heavily improved. ### Gitea Version 1.21.11 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots ![image](https://github.com/user-attachments/assets/d3f9ff01-0683-4d2a-a69b-130b8bb8d505) ### Git Version _No response_ ### Operating System Windows Server ### How are you running Gitea? Running the .exe on a Windows Server ### Database PostgreSQL
GiteaMirror added the type/enhancementtopic/packages labels 2025-11-02 10:56:48 -06:00
Author
Owner

@kemzeb commented on GitHub (Jan 2, 2025):

If it is the case that we are using deprecated metadata to get the home page URL (to me this looks to be the case), then I agree that we should use something else to get this URL. What we should do is:

  • Use the Project-URL metadata (see here)
  • Since Project-URL can be defined multiple times (e.g a URL for its bug tracker, another for its project board, etc.), we look for one with the label homepage (this is after we normalize the label; see here for "well-known project URLs")
  • Use that as the URL for the homepage
  • If we couldn't find one with a normalized label of homepage, use the empty string (as we do already)
@kemzeb commented on GitHub (Jan 2, 2025): If it is the case that we are using deprecated metadata to get the home page URL (to me this looks to be the case), then I agree that we should use something else to get this URL. What we should do is: - Use the `Project-URL` metadata (see [here](https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata-project-url)) - Since `Project-URL` can be defined multiple times (e.g a URL for its bug tracker, another for its project board, etc.), we look for one with the label `homepage` (this is after we **normalize** the [label](https://packaging.python.org/en/latest/specifications/well-known-project-urls/#well-known-project-urls); see here for "well-known project URLs") - Use that as the URL for the homepage - If we couldn't find one with a normalized label of `homepage`, use the empty string (as we do already)
Author
Owner

@kemzeb commented on GitHub (Jan 2, 2025):

I'll see if I can implement something like this today

@kemzeb commented on GitHub (Jan 2, 2025): I'll see if I can implement something like this today
Author
Owner

@satr-cowi commented on GitHub (Jan 6, 2025):

Hi guys, thanks for getting this implemented so quickly!

Not an urgent one, but would there be interest in the future in adding links for other project URLs too similar to pypi?

https://docs.pypi.org/project_metadata/

@satr-cowi commented on GitHub (Jan 6, 2025): Hi guys, thanks for getting this implemented so quickly! Not an urgent one, but would there be interest in the future in adding links for other project URLs too similar to pypi? https://docs.pypi.org/project_metadata/
Author
Owner

@lunny commented on GitHub (Jan 6, 2025):

Hi guys, thanks for getting this implemented so quickly!

Not an urgent one, but would there be interest in the future in adding links for other project URLs too similar to pypi?

docs.pypi.org/project_metadata

Please create a new issue so that it can be found by contributors.

@lunny commented on GitHub (Jan 6, 2025): > Hi guys, thanks for getting this implemented so quickly! > > Not an urgent one, but would there be interest in the future in adding links for other project URLs too similar to pypi? > > [docs.pypi.org/project_metadata](https://docs.pypi.org/project_metadata/) Please create a new issue so that it can be found by contributors.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#13905