Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
362 views
in Technique[技术] by (71.8m points)

python - How to ensure that README.rst is valid?

There are two version of my little tool:

In the last update a change in README.rst cases a warning:

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.

Now the pypi page looks ugly :-(

I use this recipe to do CI, bumpversion, upload to pypi: https://github.com/guettli/github-travis-bumpversion-pypi

How could I ensure that no broken README.rst gets released any more? With other words I want to avoid that the pypi page looks ugly.

Dear detail lovers: Please don't look into the current particular error in the README.rst. That's is not the question :-)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Update

As of Sep 21, 2018, the Python Packaging Authority recommends an alternative command twine check. To install twine:

pip install twine
twine check dist/*

Note that twine requires readme_renderer. You could still use readme_renderer, and you only need to install twine if you want its other features, which is a good idea anyway if you are releasing to PyPI.


From the official Python packaging docs, 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.

And from that tool's 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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...