我的 RST 自述文件在 PyPi 上的格式不正确

My RST README is not formatted correctly on PyPi

我上传了一个包到 pypi.org 但我的 RST 自述文件格式不正确。

这是它在 GitHub 上的样子:https://github.com/NinjaSnail1080/akinator.py

这是它在 PyPi 上的样子:https://pypi.org/project/akinator.py/

出于某种原因,在 GitHub 上所有内容的格式都正确,但在 PyPi 上,它根本没有格式化。它没有显示 RST 格式的 README,而是一堆未格式化的文本。

我在我的项目中尝试了 运行 python3 -m twine check dist/* 并得到了这个:

Checking distribution dist/akinator.py-1.0.3.dev3-py3-none-any.whl: warning: `long_description_content_type` missing.  defaulting to `text/x-rst`.
Failed
The project's long_description has invalid markup which will not be rendered on PyPI. The following syntax errors were detected:
line 26: Error: Unexpected indentation.
Checking distribution dist/akinator.py-1.0.3.dev3.tar.gz: warning: `long_description_content_type` missing.  defaulting to `text/x-rst`.
Failed
The project's long_description has invalid markup which will not be rendered on PyPI. The following syntax errors were detected:
line 26: Error: Unexpected indentation.
line 26: Error: Unexpected indentation.

出于某种原因,它说缺少 long_description_content_type,这是不正确的。我的 setup.py 文件明确指出 long_description_content_type="text/x-rst"。它还在 long description 的第 26 行中提到了意外的缩进,但该行中根本没有缩进。

我完全不知道我在这里做错了什么。不知何故,它在 GitHub 上看起来非常好,但在 PyPi 上,它只是一团糟。 twine check 给我的警告没有任何意义。

问题是您 including your entire license in the License field, but this field is only supposed to be a short description or name of the license -- 它不应该包含换行符。

这正在生成以下元数据:

Metadata-Version: 2.1
Name: akinator.py
Version: 1.0.3.dev2
Summary: An API wrapper for the online game, Akinator, written in Python
Home-page: https://github.com/NinjaSnail1080/akinator.py
Author: NinjaSnail1080
Author-email: innuganti.ashwin@gmail.com
License: MIT License

Copyright (c) 2019 NinjaSnail1080

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

第一个换行符之后的所有内容都被解释为 Long-Description

要解决此问题,只需设置 license="MIT",或完全忽略它 -- 它是可选的,并且您已经将其包含在分类器列表中。

此处 setuptools 中有一个未解决的错误可解决此问题:https://github.com/pypa/setuptools/issues/1390

我也有同样的症状。使用 python3.7 代替 python3.6 有帮助:

python3.7 setup.py sdist bdist_wheel

OS:Ubuntu 18.04.2 LTS