如何保证README.rst有效?
How to ensure that README.rst is valid?
我的小工具有两个版本:
- https://pypi.python.org/pypi/tbzuploader/2017.11.0
- https://pypi.python.org/pypi/tbzuploader/2017.12.0 Bug: pypi页面看起来很丑
在上次更新中 README.rst 个案例中的一个警告:
user@host> rst2html.py README.rst > /tmp/foo.html
README.rst:18: (WARNING/2) Inline emphasis start-string without end-string.
README.rst:18: (WARNING/2) Inline emphasis start-string without end-string.
现在pypi页面看起来很丑:-(
我用这个食谱做的CI,bumpversion,上传到pypi:https://github.com/guettli/github-travis-bumpversion-pypi
我如何确保不再有损坏的 README.rst 被释放?换句话说,我想避免 pypi 页面看起来很丑。
亲爱的细节爱好者:请不要查看README.rst中的当前特定错误。那不是问题:-)
如果 rstcheck 在您的自述文件中发现错误类型,您可以尝试。如果是这样,运行 它在你的脚本部分的 pytest 之后。 (并将其添加到您的要求中)。
更新
截至 2018 年 9 月 21 日,Python 包装管理局推荐了一个替代命令 twine check
. To install twine:
pip install twine
twine check dist/*
注意twine requires readme_renderer
。你仍然可以使用 readme_renderer
,如果你想要它的其他功能,你只需要安装 twine,无论如何,如果你要发布到 PyPI,这是一个好主意。
来自官方Python打包文档,Uploading your Project to PyPI:
Tip: The reStructuredText parser used on PyPI is not Sphinx! Furthermore, to ensure safety of all users, certain kinds of URLs and directives are forbidden or stripped out (e.g., the .. raw::
directive). Before trying to upload your distribution, you should check to see if your brief / long descriptions provided in setup.py
are valid. You can do this by following the instructions for the pypa/readme_renderer tool.
从该工具的 README.rst
:
To check your long description's locally simply install the readme_renderer
library using:
$ pip install readme_renderer
$ python setup.py check -r -s
序言
除了页面上的第一个元素(图像)之外,我有一个无法在 PyPi 上呈现的自述文件。我 运行 该文件针对多个验证器,并针对其他渲染器对其进行了测试。它在其他任何地方都工作得很好!因此,在与它进行了长时间的、令人讨厌的斗争以及多次版本颠簸之后,以便我可以测试 PyPi 修订版,我尝试将文件减少到最低限度,然后从中重新构建它。原来一直处理第一行,然后就是...
解决方案
发现关于第一行的这个线索,然后我顿悟了......我所要做的就是更改文件中的行结尾!我正在 Windows 中编辑文件,隐式添加了 Windows 行结尾。我将其更改为 Unix 风格并且(噗!)PyPi 完全呈现了文档!
咆哮...
我以前遇到过这样的事情,但我认为 PyPi 会处理这样的跨平台问题。运行我的意思是 Python 的主要特点之一是跨平台!我是在 Windows 工作的第一个遇到这种情况的人吗?!我不明白浪费了多少时间。
我的小工具有两个版本:
- https://pypi.python.org/pypi/tbzuploader/2017.11.0
- https://pypi.python.org/pypi/tbzuploader/2017.12.0 Bug: pypi页面看起来很丑
在上次更新中 README.rst 个案例中的一个警告:
user@host> rst2html.py README.rst > /tmp/foo.html
README.rst:18: (WARNING/2) Inline emphasis start-string without end-string.
README.rst:18: (WARNING/2) Inline emphasis start-string without end-string.
现在pypi页面看起来很丑:-(
我用这个食谱做的CI,bumpversion,上传到pypi:https://github.com/guettli/github-travis-bumpversion-pypi
我如何确保不再有损坏的 README.rst 被释放?换句话说,我想避免 pypi 页面看起来很丑。
亲爱的细节爱好者:请不要查看README.rst中的当前特定错误。那不是问题:-)
如果 rstcheck 在您的自述文件中发现错误类型,您可以尝试。如果是这样,运行 它在你的脚本部分的 pytest 之后。 (并将其添加到您的要求中)。
更新
截至 2018 年 9 月 21 日,Python 包装管理局推荐了一个替代命令 twine check
. To install twine:
pip install twine
twine check dist/*
注意twine requires readme_renderer
。你仍然可以使用 readme_renderer
,如果你想要它的其他功能,你只需要安装 twine,无论如何,如果你要发布到 PyPI,这是一个好主意。
来自官方Python打包文档,Uploading your Project to PyPI:
Tip: The reStructuredText parser used on PyPI is not Sphinx! Furthermore, to ensure safety of all users, certain kinds of URLs and directives are forbidden or stripped out (e.g., the
.. raw::
directive). Before trying to upload your distribution, you should check to see if your brief / long descriptions provided insetup.py
are valid. You can do this by following the instructions for the pypa/readme_renderer tool.
从该工具的 README.rst
:
To check your long description's locally simply install the
readme_renderer
library using:
$ pip install readme_renderer
$ python setup.py check -r -s
序言
除了页面上的第一个元素(图像)之外,我有一个无法在 PyPi 上呈现的自述文件。我 运行 该文件针对多个验证器,并针对其他渲染器对其进行了测试。它在其他任何地方都工作得很好!因此,在与它进行了长时间的、令人讨厌的斗争以及多次版本颠簸之后,以便我可以测试 PyPi 修订版,我尝试将文件减少到最低限度,然后从中重新构建它。原来一直处理第一行,然后就是...
解决方案
发现关于第一行的这个线索,然后我顿悟了......我所要做的就是更改文件中的行结尾!我正在 Windows 中编辑文件,隐式添加了 Windows 行结尾。我将其更改为 Unix 风格并且(噗!)PyPi 完全呈现了文档!
咆哮...
我以前遇到过这样的事情,但我认为 PyPi 会处理这样的跨平台问题。运行我的意思是 Python 的主要特点之一是跨平台!我是在 Windows 工作的第一个遇到这种情况的人吗?!我不明白浪费了多少时间。