Search code examples
pythonsetuptoolspypipython-packaging

How do I provide a link to a changelog for a package on PyPI?


Some PyPI projects provide a bunch of links in the sidebar, including to a changelog. For example, Django provides these links at https://pypi.org/project/Django/ :

Screenshot

How do I add a link to my project for a change log or a release log?


Solution

  • The link to the change log is like other project links located in your setup.py or setup.cfg file.

    If you are using setuptools, you can use the project_urls keyword argument in your setup.py file, like this:

    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',
        },
    )
    

    The project_urls keyword argument takes a dictionary mapping link captions to their URLs. The link captions can be anything you like, they will be displayed on the PyPI project page, so use English labels.

    If you prefer to use setup.cfg, you can add these lines to your 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
    

    If you want to ensure that the icon used is the scroll icon, make sure the key used is one of these case-insensitive keys (found here):

    ["changelog", "change log", "changes", "release notes", "news", "what's new", "history"]