Small knowledge, big challenge! This article is participating in the “Essentials for Programmers” creative activity. This article has participated in the “Digitalstar Project” to win a creative gift package and challenge the creative incentive money.

Before the thunder committee gave you a glimpse of how to develop a Python library and import run, basically complete a preliminary library, but also support the release of command line tools.

This article aims to provide a generic solution to accommodate all scenarios with ending RST file rendering errors!

This is especially true for newcomers to open source projects:

# For example, the student committee will also encounter this mistake. The description failed to render in The default format of reStructuredText. See pypi.org/help/#descr… for more information.

Of course, as a development veteran sometimes also encounter, because accidentally RST format file content is very sensitive, sometimes do not often knock this, knock wrong report error.

Pypi library upload error:

ReStructuredText is the first step

ReStructuredText is a kind of text that is often used in Python projects to explain reStructuredText or program modules. Many projects also come with RST files, which are then used to generate project documentation.

Simply understood as text, it can be used to represent paragraphs, code, hyperlinks, and styles.

Step 2: Make mistakes

The root cause of the error is that the content of the RST is not up to standard.

Many tools support RST file visualization, which looks fine, but fails when applied to pYPI.

I’ll talk more about that.

The title format is wrong

The header format is wrong

===================
pypi_seed
===================
Copy the code

And section titles in this format

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Further discussion/use more problem -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - both Please raise PR or find the tencent group chat: https://jq.qq.com/?_wv=1027&k=ISjeG32xCopy the code

The third step is to solve it

Both of the above errors are not recognized by PyCharm’s RST visualization tool. The format of the header is changed to the following and will be parsed normally

pypi_seed
=========
Copy the code

Refer to the following format for section titles:

Further Discussion -------------------------- Please raise PR or find the Tencent group chat: https://jq.qq.com/?_wv=1027&k=ISjeG32xCopy the code

Other errors

For example:

Shorten the section title because it is too long. Resubmit.

Bash Further discussion/more -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -Copy the code

RST files support many formats and cannot be listed individually.

Here’s a general approach.

None of the above: just look for an open source project

Sometimes it takes a long time to change your RST file.

At this point, we have to divide the whole into parts.

Find an open source project’s readme. RST file to refer to:

Raw.githubusercontent.com/py4ever/pyp…

Or on Gitee:

Gitee.com/py4ever/pyp…

Install the contents inside to modify your own RST file.

Tip 01

Section modification, a new file to paste in a paragraph of a paragraph, until the final generation of their own RST file.

Tip.

Write markdown first, then use the tool: cloudconvert.com/md-to-rst

conclusion

Readme. RST is available in many open source Python projects.

We can’t document every programming problem. The code changes, the technology changes, the only thing we need to do is to use our brains and find the right examples.

Pypi-Seed on Github

If you like Python, please check out the Basic Python column of the Learning Committee or the Getting Started to Master Python column

Continuous learning and continuous development, I am Lei Xuewei! Programming is fun. The key is to get the technology right. Creation is not easy, please pay attention to the collection of likes, or leave a comment to encourage!

Reference links:

The docutils. Sourceforge. IO/docs/ref/rs…