README Generator · Tutorial

How to write a README for a Python package on PyPI

6 min readbeginnerUpdated

PyPI shows your README as the package’s description, so it is often the first thing users see before installing. You will build one with the right install command and example, then connect it to your package metadata.

What you need

Steps

  1. Load the Python example

    It sets Install with to pip, which adds a PyPI version badge and pip install tidyrates.

  2. Show the import

    Set the code language to python and show how to import and call the main function in three or four lines.

  3. Use absolute links for images

    PyPI doesn’t resolve relative paths. If you add a screenshot, use its full URL on GitHub (the raw file link) so it shows in both places.

  4. Point your package at the README

    In pyproject.toml, tell the build tool to use the file as the long description.

    [project]
    name = "tidyrates"
    readme = "README.md"

Try it yourself

Opens the README Generator with this tutorial's sample loaded.

Try it now

Common mistakes

Package name differs from the import name
If people install tidy-rates but import tidyrates, fill in Package name so the install command and badge use the right name.
Forgetting to rebuild
PyPI only updates the description when you upload a new version.

Next steps

Go back to the README Generator, or keep going with one of these: