Skip to content

Commit 4077165

Browse files
committed
Prefer pyproject readme metadata
1 parent a9b1f5e commit 4077165

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,32 @@ Formats supported by `PyPI's README renderer <https://github.com/pypa/readme_ren
1818
* Markdown (`GitHub Flavored Markdown <https://github.github.com/gfm/>`_ by default,
1919
or `CommonMark <https://commonmark.org/>`_)
2020

21-
It's customary to save your README file in the root of your project, in the same directory as your :file:`setup.py` file.
21+
It's customary to save your README file in the root of your project, in the
22+
same directory as your :file:`pyproject.toml` file.
2223

2324

2425
Including your README in your package's metadata
2526
------------------------------------------------
2627

27-
To include your README's contents as your package description,
28-
set your project's ``Description`` and ``Description-Content-Type`` metadata,
29-
typically in your project's :file:`setup.py` file.
28+
To include your README's contents as your package description, set the
29+
``readme`` key in your project's :file:`pyproject.toml` file:
30+
31+
.. code-block:: toml
32+
33+
[project]
34+
readme = "README.md"
35+
36+
This sets your project's ``Description`` and ``Description-Content-Type``
37+
metadata.
3038

3139
.. seealso::
3240

41+
* :ref:`writing-pyproject-toml`
3342
* :ref:`description-optional`
3443
* :ref:`description-content-type-optional`
3544

36-
For example, to set these values in a package's :file:`setup.py` file,
37-
use ``setup()``'s ``long_description`` and ``long_description_content_type``.
45+
If your project still configures metadata in :file:`setup.py`, use ``setup()``'s
46+
``long_description`` and ``long_description_content_type``.
3847

3948
Set the value of ``long_description`` to the contents (not the path) of the README file itself.
4049
Set the ``long_description_content_type`` to an accepted ``Content-Type``-style value for your README file's markup,
@@ -89,6 +98,10 @@ and identifies the markup as GitHub-flavored Markdown:
8998
long_description_content_type='text/markdown'
9099
)
91100
101+
When using this approach, make sure the README file is included in your source
102+
distribution. :ref:`setuptools` includes common README names by default; other
103+
build backends may require explicit configuration.
104+
92105

93106
Validating reStructuredText markup
94107
----------------------------------

0 commit comments

Comments
 (0)