Skip to content

Commit 886bb62

Browse files
committed
Various updates for PEP 643
1. Remove the whitelist of fields allowed to be dynamic. 2. Allow Dynamic outside of source distributions.
1 parent 311b358 commit 886bb62

2 files changed

Lines changed: 27 additions & 24 deletions

File tree

source/specifications/core-metadata.rst

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -84,26 +84,29 @@ Dynamic (multiple use)
8484

8585
.. versionadded:: 2.2
8686

87-
Only permitted in source distribution (sdist) file metadata.
88-
89-
A string containing the name of another core metadata field. Only the following
90-
metadata field names may be used as the value of the ``Dynamic`` field.
91-
92-
* ``Platform``
93-
* ``Supported-Platform``
94-
* ``Requires-Dist``
95-
* ``Requires-External``
96-
* ``Provides-Extra``
97-
* ``Provides-Dist``
98-
* ``Obsoletes-Dist``
99-
100-
Unless specified via ``Dynamic``, *all* metadata in a wheel must be identical to
101-
the metadata of the sdist from which the wheel was built. If a field is named in
102-
``Dynamic`` in the sdist, then there is no constraint on what value that field
103-
may have in wheels built from the sdist.
104-
105-
If the sdist metadata version is older than version 2.2, then there are no
106-
constraints on the metadata of wheels built from that sdist.
87+
A string containing the name of another core metadata field. The field
88+
names ``Name`` and ``Version`` may not be specified in this field.
89+
90+
When found in the metadata of a source distribution, the following
91+
rules apply:
92+
93+
1. If a field is *not* marked as ``Dynamic``, then the value of the field
94+
in any wheel built from the sdist MUST match the value in the sdist.
95+
If the field is not in the sdist, and not marked as ``Dynamic``, then
96+
it MUST NOT be present in the wheel.
97+
2. If a field is marked as ``Dynamic``, it may contain any valid value in
98+
a wheel built from the sdist (including not being present at all).
99+
100+
If the sdist metadata version is older than version 2.2, then all fields should
101+
be treated as if they were specified with ``Dynamic`` (i.e. there are no special
102+
restrictions on the metadata of wheels built from the sdist).
103+
104+
In any context other than a source distribution, ``Dynamic`` is for information
105+
only, and indicates that the field value was calculated at wheel build time,
106+
and may not be the same as the value in the sdist or in other wheels for the
107+
project.
108+
109+
Full details of the semantics of ``Dynamic`` are described in :pep:`643`.
107110

108111

109112
Platform (multiple use)

source/specifications/source-distribution-format.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ documented here.
1313
There is also the legacy source distribution format, implicitly defined by the
1414
behaviour of ``distutils`` module in the standard library, when executing
1515
``setup.py sdist``. This document does not attempt to standardise this format,
16-
except to note that if a legacy sdist contains a ``PKG-INFO`` file holding
17-
metadata version 2.2 or later, that sdist MUST follow the rules for sdists
18-
defined by the metadata specification.
16+
except to note that if a legacy source distribution contains a ``PKG-INFO``
17+
file holding metadata version 2.2 or later, then it MUST follow the rules
18+
applicable to source distributions defined in the metadata specification.
1919

2020
Source distributions are also known as *sdists* for short.
2121

@@ -33,7 +33,7 @@ in the metadata contained in the file.
3333
Source distribution file format
3434
===============================
3535

36-
A .tar.gz source distribution (sdist) contains a single top-level directory
36+
A ``.tar.gz`` source distribution (sdist) contains a single top-level directory
3737
called ``{name}-{version}`` (e.g. ``foo-1.0``), containing the source files of
3838
the package. The name and version MUST match the metadata stored in the file.
3939
This directory must also contain a ``pyproject.toml`` in the format defined in

0 commit comments

Comments
 (0)