Skip to content

Commit 55ee729

Browse files
committed
Document how to display README images on PyPI
Add Markdown and reStructuredText examples using public image URLs. Note that relative paths to images bundled in distribution archives do not work for PyPI descriptions, as well as the limitations on embedded media. Closes gh-1110
1 parent 41f7052 commit 55ee729

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,37 @@ provide both the file path and content type explicitly:
5656
The referenced README should remain in the project source tree so the build
5757
backend can read it when producing package metadata.
5858

59+
60+
Adding images
61+
-------------
62+
63+
To display an image in your project's description on PyPI, use a publicly
64+
accessible HTTPS URL pointing directly to the image. For an image hosted in a
65+
source repository, use the raw file URL rather than the repository's page for
66+
the file.
67+
68+
In :file:`README.md`, use Markdown image syntax:
69+
70+
.. code-block:: markdown
71+
72+
![Screenshot of the application](https://example.com/screenshot.png)
73+
74+
In :file:`README.rst`, use the reStructuredText ``image`` directive:
75+
76+
.. code-block:: rst
77+
78+
.. image:: https://example.com/screenshot.png
79+
:alt: Screenshot of the application
80+
81+
Relative paths such as ``docs/screenshot.png`` may work on your repository's
82+
website, but will not work on PyPI. PyPI does not serve image files from your
83+
uploaded source distribution or wheel for use in the project description.
84+
85+
The same approach works for logos, badges, and animated GIFs. Base64-encoded
86+
``data:`` URLs and embedded video players are not supported; link to externally
87+
hosted videos instead.
88+
89+
5990
Validating reStructuredText markup
6091
----------------------------------
6192

0 commit comments

Comments
 (0)