Reputation: 1371
How do I add links under the Project Links
section of my PyPI project?
Upvotes: 15
Views: 3195
Reputation: 18186
Poetry does this a bit differently, but it's the same idea.
You can put some basic info in the main part of your pyproject.toml file, under [tool.poetry]
. Something like:
[tool.poetry]
homepage = "https://free.law/projects/x-ray"
repository = "https://github.com/freelawproject/x-ray"
documentation = "https://github.com/freelawproject/x-ray/blob/main/README.md"
And if you want even more URLs, you can do something like:
[tool.poetry.urls]
"Organisation Homepage" = "https://free.law/"
"Change Log" = "https://github.com/freelawproject/x-ray/blob/main/CHANGES.md"
Issues = "https://github.com/freelawproject/x-ray/issues"
Funding = "https://www.courtlistener.com/donate/?referrer=pypi-xray"
There's a list of special values that'll get you icons, but it seems like you can put whatever you want here and Poetry will be happy. If Pypi doesn't know what the link is, it'll just put a generic icon next to it.
Here's the list of things that get icons:
https://github.com/pypi/warehouse/blob/main/warehouse/templates/packaging/detail.html
Upvotes: 8
Reputation: 358
If you want to know for which URL identifier which icon is used on PyPI,e.g. if you write
project_urls = {
'Twitter': 'https://twitter.com/PyScaffold',
}
you will see the Twitter bird on PyPI, e.g. https://pypi.org/project/PyScaffold/.
In order to see the available icons and when there are set, just check out this file(/warehouse/templates/packaging/detail.html
) from the PyPI source code.
Upvotes: 8
Reputation: 1371
This question has been answered before but was a bit difficult to find, so hopefully this one is a bit easier.
PyPI pulls these links from the project_urls
metadata.
In your setup.py
file, call setuptools.setup()
with the project_urls
argument as a dictionary of title-url pairs.
import setuptools
project_urls = {
'Link 1': 'https://mygreatsite.com',
'Link 2': 'https://anothersite.com'
}
setuptools.setup( other_arguments, project_urls = project_urls )
Upvotes: 21