Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To Set Project Links in PyPI

How do I add links under the Project Links section of my PyPI project?

like image 974
bicarlsen Avatar asked Apr 11 '20 11:04

bicarlsen


People also ask

What is twine Python?

Twine is a utility for publishing Python packages to PyPI and other repositories. It provides build system independent uploads of source and binary distribution artifacts for both new and existing projects.

What is the use of setup py?

Use of Setup.py It primarily serves two purposes: It includes choices and metadata about the program, such as the package name, version, author, license, minimal dependencies, entry points, data files, and so on. Secondly, it serves as the command line interface via which packaging commands may be executed.


2 Answers

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 )
like image 169
bicarlsen Avatar answered Oct 17 '22 02:10

bicarlsen


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.

like image 7
fwilhelm Avatar answered Oct 17 '22 03:10

fwilhelm