一些 PyPI 项目在侧边栏中提供了一堆链接,包括更改日志的链接。例如,Django 在 https://pypi.org/project/Django/ :
提供这些链接如何添加指向我的项目的更改日志或发布日志的链接?
更改日志的链接就像位于
setup.py
或 setup.cfg
文件中的其他项目链接一样。
如果您使用
setuptools
,则可以在 project_urls
文件中使用
setup.py
关键字参数,如下所示:
from setuptools import setup
setup(
name='foobar',
version='1.0',
# ...
project_urls={
'Documentation': 'https://example.com/documentation/',
'GitHub': 'https://github.com/foobar/foobar/',
'Changelog': 'https://github.com/foobar/foobar/blob/master/CHANGELOG.md',
},
)
project_urls
关键字参数采用字典将链接标题映射到其 URL。链接标题可以是任何你喜欢的内容,它们将显示在 PyPI 项目页面上,因此请使用英文标签。
如果您更喜欢使用
setup.cfg
,您可以将这些行添加到您的 setup.cfg
:
project_urls =
Documentation = https://example.com/documentation/
GitHub = https://github.com/foobar/foobar
Changelog = https://github.com/foobar/foobar/blob/master/CHANGELOG.md
如果您想确保使用的图标是滚动图标,请确保使用的键是这些不区分大小写的键之一(在此处找到):
["changelog", "change log", "changes", "release notes", "news", "what's new", "history"]