Skip to content

Commit b554032

Browse files
committed
Update pyproject.toml specification according to PEP 639
Redefine the license key, add license-files, mention that license classifiers are deprecated now.
1 parent e5fe842 commit b554032

File tree

1 file changed

+71
-8
lines changed

1 file changed

+71
-8
lines changed

source/specifications/pyproject-toml.rst

Lines changed: 71 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ The complete list of keys allowed in the ``[project]`` table are:
138138
- ``gui-scripts``
139139
- ``keywords``
140140
- ``license``
141+
- ``license-files``
141142
- ``maintainers``
142143
- ``name``
143144
- ``optional-dependencies``
@@ -236,16 +237,70 @@ The Python version requirements of the project.
236237
``license``
237238
-----------
238239

239-
- TOML_ type: table
240+
- TOML_ type: string
241+
- Corresponding :ref:`core metadata <core-metadata>` field:
242+
:ref:`License-Expression <core-metadata-license-expression>`
243+
244+
Text string that is a valid SPDX license expression as defined in :pep:`639`.
245+
Tools SHOULD validate and perform case normalization of the expression.
246+
247+
The table subkeys of the ``license`` key are deprecated.
248+
249+
250+
``license-files``
251+
-----------------
252+
253+
- TOML_ type: array of strings
240254
- Corresponding :ref:`core metadata <core-metadata>` field:
241-
:ref:`License <core-metadata-license>`
255+
:ref:`License-Expression <core-metadata-license-file>`
256+
257+
An array specifying paths in the project source tree relative to the project
258+
root directory (i.e. directory containing :file:`pyproject.toml` or legacy project
259+
configuration files, e.g. :file:`setup.py`, :file:`setup.cfg`, etc.)
260+
to file(s) containing licenses and other legal notices to be
261+
distributed with the package.
262+
263+
The strings MUST contain valid glob patterns, as specified below:
242264

243-
The table may have one of two keys. The ``file`` key has a string
244-
value that is a file path relative to ``pyproject.toml`` to the file
245-
which contains the license for the project. Tools MUST assume the
246-
file's encoding is UTF-8. The ``text`` key has a string value which is
247-
the license of the project. These keys are mutually exclusive, so a
248-
tool MUST raise an error if the metadata specifies both keys.
265+
- Alphanumeric characters, underscores (``_``), hyphens (``-``) and dots (``.``)
266+
MUST be matched verbatim.
267+
268+
- Special glob characters: ``*``, ``?``, ``**`` and character ranges: ``[]``
269+
containing only the verbatim matched characters MUST be supported.
270+
Within ``[...]``, the hyphen indicates a locale-agnostic range (e.g. ``a-z``,
271+
order based on Unicode code points).
272+
Hyphens at the start or end are matched literally.
273+
274+
- Path delimiters MUST be the forward slash character (``/``).
275+
Patterns are relative to the directory containing :file:`pyproject.toml`,
276+
therefore the leading slash character MUST NOT be used.
277+
278+
- Parent directory indicators (``..``) MUST NOT be used.
279+
280+
Any characters or character sequences not covered by this specification are
281+
invalid. Projects MUST NOT use such values.
282+
Tools consuming this field SHOULD reject invalid values with an error.
283+
284+
Tools MUST assume that license file content is valid UTF-8 encoded text,
285+
and SHOULD validate this and raise an error if it is not.
286+
287+
Literal paths (e.g. :file:`LICENSE`) are valid globs which means they
288+
can also be defined.
289+
290+
Build tools:
291+
292+
- MUST treat each value as a glob pattern, and MUST raise an error if the
293+
pattern contains invalid glob syntax.
294+
- MUST include all files matched by a listed pattern in all distribution
295+
archives.
296+
- MUST list each matched file path under a License-File field in the
297+
Core Metadata.
298+
- MUST raise an error if any individual user-specified pattern does not match
299+
at least one file.
300+
301+
If the ``license-files`` key is present and
302+
is set to a value of an empty array, then tools MUST NOT include any
303+
license files and MUST NOT raise an error.
249304

250305

251306
``authors``/``maintainers``
@@ -309,6 +364,12 @@ The keywords for the project.
309364

310365
Trove classifiers which apply to the project.
311366

367+
The use of ``License ::`` classifiers is deprecated and tools MAY issue a
368+
warning informing users about that.
369+
Build tools MAY raise an error if both the ``license`` string value
370+
(translating to ``License-Expression`` metadata field) and the ``License ::``
371+
classifiers are used.
372+
312373

313374
``urls``
314375
--------
@@ -450,6 +511,8 @@ History
450511
- November 2020: The specification of the ``[project]`` table was approved
451512
through :pep:`621`.
452513

514+
- December 2024: The ``license`` key was redefined, the ``license-files`` key was
515+
added and ``License::`` classifiers were deprecated through :pep:`639`.
453516

454517

455518
.. _TOML: https://toml.io

0 commit comments

Comments
 (0)