gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 16:59:31 26 4
gpt4 key购买 nike

我将一个包上传到 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 licenseLicense 字段中,但是这个字段是 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

关于python - 我的 RST 自述文件在 PyPi 上的格式不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55422373/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com