【问题标题】:twine: warning: `long_description_content_type` missing麻线:警告:缺少`long_description_content_type`
【发布时间】:2020-12-04 08:56:17
【问题描述】:

这就是我的 setup.py 的样子:

from distutils.core import setup

setup(
    author='...',
    description='...',
    download_url='...',
    license='...',
    long_description=open('README.md', 'r').read(),
    long_description_content_type='text/markdown',
    name='...',
    packages=['...'],
    url='...',
    version='...'
)

然后,我可以运行python setup.py sdist 而不会出现任何错误。但如果我用麻线 (twine check dist/*) 检查包裹,我会收到以下警告:

 `long_description` has syntax errors in markup and would not be rendered on PyPI.
  warning: `long_description_content_type` missing. defaulting to `text/x-rst`.

我所有的包都是最新的,我没有重复或多行属性。这是什么原因造成的,我该如何解决?

【问题讨论】:

    标签: python setuptools setup.py pypi twine


    【解决方案1】:

    这是因为您使用的是distutils.core 提供的设置功能。请改用setuptools:

    from setuptools import setup
    

    distutils.core 不希望提供long_description_content_type,并且似乎忽略了它。当你运行 setup.py 时,它实际上是这样说的:

    UserWarning: Unknown distribution option: 'long_description_content_type'
    

    虽然这很容易被忽略,因为它位于一长串无错误日志的顶部。

    【讨论】:

      猜你喜欢
      • 2015-11-20
      • 1970-01-01
      • 2013-05-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-06
      相关资源
      最近更新 更多