Skip to content

Commit 3ea6dd3

Browse files
wcooleytheacodes
authored andcommitted
Mention Sphinx extensions in "Making a PyPI-friendly README" (#562)
I thought I was doing the right thing by including [Sphinx cross-references](http://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#cross-referencing-python-objects) in my `README.rst` and through that in my package's `long_description`, but only after several failed validations and searching did I learn that Sphinx extensions are not allowed. The error message from `twine check` (or `rst-lint`) is not obvious about what is wrong: e.g., 'Error: Unknown interpreted text role "py:func".' and to those just figuring out Sphinx and rST the distinction is not necessarily obvious.
1 parent fa91256 commit 3ea6dd3

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎source/guides/making-a-pypi-friendly-readme.rst‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ For your README to display properly on PyPI, choose a markup language supported
1414
Formats supported by `PyPI's README renderer <https://github.com/pypa/readme_renderer>`_ are:
1515

1616
* plain text
17-
* `reStructuredText <http://docutils.sourceforge.net/rst.html>`_
17+
* `reStructuredText <http://docutils.sourceforge.net/rst.html>`_ (without Sphinx extensions)
1818
* Markdown (`GitHub Flavored Markdown <https://github.github.com/gfm/>`_ by default,
1919
or `CommonMark <http://commonmark.org/>`_)
2020

@@ -88,6 +88,12 @@ Validating reStructuredText markup
8888

8989
If your README is written in reStructuredText, any invalid markup will prevent
9090
it from rendering, causing PyPI to instead just show the README's raw source.
91+
92+
Note that Sphinx extensions used in docstrings, such as
93+
`directives and roles <http://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
94+
(e.g., "``:py:func:`getattr```" or "``:ref:`my-reference-label```"), are not allowed here and will result in error
95+
messages like "``Error: Unknown interpreted text role "py:func".``".
96+
9197
You can check your README for markup errors before uploading as follows:
9298

9399
1. Install the latest version of `twine <https://github.com/pypa/twine>`_;

0 commit comments

Comments
 (0)