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
- The README Generator
- A Python package with a pyproject.toml
Steps
Load the Python example
It sets Install with to pip, which adds a PyPI version badge and
pip install tidyrates.Show the import
Set the code language to
pythonand show how to import and call the main function in three or four lines.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.
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.
Common mistakes
- Package name differs from the import name
- If people install
tidy-ratesbut importtidyrates, 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: