为什么我的setup.py长描述不在pypi上显示?

时间:2017-07-14 13:29:25

标签: python setuptools restructuredtext pypi

尝试将包上传到pypi,除了我的long_description之外它都可以正常工作。这是为了阅读我的README.rst,但它在pypi上只是空白。 docutils rst2html没有抛出任何错误,setup.py --long-description打印出我的自述文件,setup.py -check也没有产生错误。

https://pypi.python.org/pypi/cryptocli

Setup.py:

# -*- coding: utf-8 -*-

from setuptools import setup, find_packages


with open('README.rst') as f:
    readme = f.read()

with open('LICENSE') as f:
    license = f.read()

setup(
    name='cryptocli',
    version='0.1.3',
    description='CLI to query cryptocurrency value',
    long_description=readme,
    author='huwwp',
    author_email='hpigott@gmail.com',
    url='https://github.com/huwwp/cryptocli',
    license=license,
    keywords='crypto cli query cryptocurrency bitcoin',
    packages=find_packages(exclude=('tests', 'docs')),
    install_requires=['requests'],
    py_modules=['cryptocli'],
    entry_points = {
        'console_scripts': ['cryptocli = cryptocli:main'],
    }
)

README.rst:

cryptocli
=========

Command line interface for querying current value of cryptocurrenies in
given fiat.

Usage
-----

Simple query

.. code:: bash

    cryptocli BTC
    2332.1

Accepts a comma seperated list of coins

.. code:: bash

    cryptocli BTC,ETH,XMR
    2404.39
    218.53
    40

Query with conversion to a given currency.

.. code:: bash

    cryptocli BTC,ETH,XMR -c JPY
    269731.76
    24712.42
    4563.86

Query with conversion and outputting a formatted string

.. code:: bash

    cryptocli BTC,ETH,XMR -c JPY -f
    BTCJPY:269679.75
    ETHJPY:24718.85
    XMRJPY:4562.29

Credits
-------

Uses the cryptocompare.com API

Tipjar
------

BTC: 15wNW29q7XAEbC8yus49CWvt91JkhcdkoW

Disclosure
----------

I am not liable for the accuracy of this program’s output nor actions
performed based upon it.

1 个答案:

答案 0 :(得分:4)

license参数用于提供您正在使用的软件许可证的名称(例如'MIT''GPLv2'),而不是用于提供许可证的全部文本。显然,您用于构建sdist的任何版本的setuptools都无法处理多行许可证,因为sdist中的PKG-INFO文件如下所示:

Metadata-Version: 1.0
Name: cryptocli
Version: 0.1.3
Summary: CLI to query cryptocurrency value
Home-page: https://github.com/huwwp/cryptocli
Author: huwwp
Author-email: hpigott@gmail.com
License: MIT License

Copyright (c) 2017 huwwp

Permission is hereby granted, ...

Description: cryptocli
        =========

        Command line interface for querying current value of cryptocurrenies in
        given fiat.
...

setuptools未能缩进许可证文本会导致PKG-INFO的所有后续字段(包括长描述和关键字)无法解析,因此它们不会显示在PyPI上。您应该在license='MIT'中写下setup.py

(顺便提一下,您的LICENSE文件不会自动包含在您的sdist中,除非您将其列在MANIFEST.in文件中,并且缺少LICENSE会导致您setup.py失败,所以当前没有人可以按原样安装你的包!)