From 55ee72956d1e2fbc378d6e95629c768ec5db5ed9 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Fri, 13 Nov 2026 15:27:04 +0000 Subject: [PATCH 1/3] 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 --- .../guides/making-a-pypi-friendly-readme.rst | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/source/guides/making-a-pypi-friendly-readme.rst b/source/guides/making-a-pypi-friendly-readme.rst index b05b4a7a15..f98eb7bd48 100644 --- a/source/guides/making-a-pypi-friendly-readme.rst +++ b/source/guides/making-a-pypi-friendly-readme.rst @@ -56,6 +56,37 @@ provide both the file path and content type explicitly: The referenced README should remain in the project source tree so the build backend can read it when producing package metadata. + +Adding images +------------- + +To display an image in your project's description on PyPI, use a publicly +accessible HTTPS URL pointing directly to the image. For an image hosted in a +source repository, use the raw file URL rather than the repository's page for +the file. + +In :file:`README.md`, use Markdown image syntax: + +.. code-block:: markdown + + ![Screenshot of the application](https://example.com/screenshot.png) + +In :file:`README.rst`, use the reStructuredText ``image`` directive: + +.. code-block:: rst + + .. image:: https://example.com/screenshot.png + :alt: Screenshot of the application + +Relative paths such as ``docs/screenshot.png`` may work on your repository's +website, but will not work on PyPI. PyPI does not serve image files from your +uploaded source distribution or wheel for use in the project description. + +The same approach works for logos, badges, and animated GIFs. Base64-encoded +``data:`` URLs and embedded video players are not supported; link to externally +hosted videos instead. + + Validating reStructuredText markup ---------------------------------- From 8e0fca4b2105f1ce4cf5ce3f7d4580093126fff8 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Mon, 16 Nov 2026 20:17:31 +0100 Subject: [PATCH 2/3] Make statement on (lack of) support for data URLs more accurate --- source/guides/making-a-pypi-friendly-readme.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/guides/making-a-pypi-friendly-readme.rst b/source/guides/making-a-pypi-friendly-readme.rst index f98eb7bd48..6bcc1ed3ef 100644 --- a/source/guides/making-a-pypi-friendly-readme.rst +++ b/source/guides/making-a-pypi-friendly-readme.rst @@ -82,9 +82,9 @@ Relative paths such as ``docs/screenshot.png`` may work on your repository's website, but will not work on PyPI. PyPI does not serve image files from your uploaded source distribution or wheel for use in the project description. -The same approach works for logos, badges, and animated GIFs. Base64-encoded -``data:`` URLs and embedded video players are not supported; link to externally -hosted videos instead. +The same approach works for logos, badges, and animated GIFs. ``data:`` URLs and +embedded video players are not supported; link to externally hosted videos +instead. Validating reStructuredText markup From 635cb438079a6c91aaddf5edf6c881281e152352 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Tue, 17 Nov 2026 18:56:31 +0100 Subject: [PATCH 3/3] Use tabs for Markdown and reStructuredText, addresses review comment --- .../guides/making-a-pypi-friendly-readme.rst | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/source/guides/making-a-pypi-friendly-readme.rst b/source/guides/making-a-pypi-friendly-readme.rst index 6bcc1ed3ef..daca402252 100644 --- a/source/guides/making-a-pypi-friendly-readme.rst +++ b/source/guides/making-a-pypi-friendly-readme.rst @@ -65,18 +65,22 @@ accessible HTTPS URL pointing directly to the image. For an image hosted in a source repository, use the raw file URL rather than the repository's page for the file. -In :file:`README.md`, use Markdown image syntax: +.. tab:: Markdown -.. code-block:: markdown + In :file:`README.md`, use Markdown image syntax: - ![Screenshot of the application](https://example.com/screenshot.png) + .. code-block:: markdown -In :file:`README.rst`, use the reStructuredText ``image`` directive: + ![Screenshot of the application](https://example.com/screenshot.png) -.. code-block:: rst +.. tab:: reStructuredText - .. image:: https://example.com/screenshot.png - :alt: Screenshot of the application + In :file:`README.rst`, use the reStructuredText ``image`` directive: + + .. code-block:: rst + + .. image:: https://example.com/screenshot.png + :alt: Screenshot of the application Relative paths such as ``docs/screenshot.png`` may work on your repository's website, but will not work on PyPI. PyPI does not serve image files from your