how to set bug tracker url in setup.py script

时间秒杀一切 提交于 2019-12-03 10:55:16

问题


I have just discovered the pypi web UI have a field 'Bug tracker URL' in edit of egg metadata.

This field exists so I guess it is supported in setup.py but I can't find anything about this using google.

So the question how do I set up this field in my setup.py so when doing a dist release on pypi it can be automaticly filled.


回答1:


The entry is called bugtrack_url, but it's not being picked up from setup.py.

From context and code I understand it was intended to be used through-the-web on PyPI only, as per-project metadata, and not the usual per-release information.

The field is now considered a legacy field (hardcoded to None) and you instead add such information through the Project-URL list, which you can set in setuptools via the project_urls entry:

    project_urls={
        'Documentation': 'https://packaging.python.org/tutorials/distributing-packages/',
        'Funding': 'https://donate.pypi.org',
        'Say Thanks!': 'http://saythanks.io/to/example',
        'Source': 'https://github.com/pypa/sampleproject/',
        'Tracker': 'https://github.com/pypa/sampleproject/issues',
    },

This option was finally added to setuptools in November 2017, and landed in version 38.3.0.




回答2:


Bug tracker URL on PyPi project

In setup.py use project_urls in the setup :

setup(
...
    project_urls={
        'Documentation': 'https://readthedocs.io/',
        'Funding': 'https://donate.pypi.org',
        'Say Thanks!': 'http://saythanks.io/to/example',
        'Source': 'https://github.com/pypa/sampleproject/',
        'Tracker': 'https://github.com/pypa/sampleproject/issues',
    },
...
)

The dict order is kept but listed in reversed on PyPi:

About PyPi bugtracker_url legacy code

pypa/warehouse Issue #233

bugtrack_url: IIRC it was something added by the PyPI maintainers to help projects, but in parallel PEP 345 introduced Project-URL which was intended to cover source code repository, bug tracker, mailing list, etc. If PEP 426 or one of its companion keeps Project-URL (and maybe improves it with defined labels for common sites, e.g. "repository"), then this special case becomes redundant.

And

At the moment, it looks like this is hardcoded to None in their API. I guess they left the field for backwards compatibility when they migrated...



来源:https://stackoverflow.com/questions/14459828/how-to-set-bug-tracker-url-in-setup-py-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!