@@ -42,7 +42,7 @@ spaces and a pipe ('``|``') character. While ``Description`` may now be encoded
4242the message body, similar escaping issues occur for the ``Author `` and
4343``Maintainer `` fields. Improperly escaped newlines can lead to missing,
4444partial, or invalid core metadata. Second, as discussed in the
45- `core metadata specifications <https:// packaging.python.org/specifications/ core-metadata/ >`__ :
45+ :ref: `core metadata specifications <packaging: core-metadata >` :
4646
4747.. epigraph ::
4848
@@ -61,25 +61,26 @@ However, the core metadata specifications also requires that core metadata is
6161encoded using UTF-8 when written to a file. This de-facto makes the core
6262metadata follow :rfc: `6532 `, which specifies internationalization of email
6363headers. This has practical interoperability concerns. Until a few years ago,
64- it was unspecified how to handle non-ASCII encoded content in core metadata,
65- causing confusion about how to properly encode non-ASCII emails in core
66- metadata. Third, the current format is difficult to properly validate and
67- parse. Many tools do not check for issues with the output of the :mod: ` !email `
68- parser. If a document is malformed, it may still parse without error by the
69- :mod: ` !email ` module as a valid email message. Furthermore, due to limitations
70- in the email format, fields like `` Project-Url `` must create custom encodings
71- of nested key-value items, further complicating parsing. Finally, the lack of
72- a schema makes it difficult to validate the contents of email message encoded
73- metadata. While introducing a specification for the current format has been
74- `discussed previously <https://discuss.python.org/t/7550 >`__,
75- no progress had been made, and converting to JSON was a suggested resolution
76- to the issues raised.
64+ it was unspecified how to properly encode non-ASCII emails in core
65+ metadata, making parsing ambiguous. Third, the current format is difficult to
66+ properly validate and parse. Many tools do not check for issues with the output
67+ of the :mod: ` !email ` parser. If a document is malformed, it may still parse
68+ without error by the :mod: ` !email ` module as a valid email message. Furthermore,
69+ due to limitations in the email format, fields like `` Project-Url `` must create
70+ custom encodings of nested key-value items, further complicating parsing and
71+ validation. Finally, the lack of a schema makes it difficult to validate the
72+ contents of email message encoded metadata. While introducing a specification
73+ for the current format has been
74+ `discussed previously <https://discuss.python.org/t/7550 >`__, no progress had
75+ been made, and converting to JSON was a suggested resolution to the issues
76+ raised.
7777
7878The ``WHEEL `` file format is currently encoded in a custom key-value format.
7979While this format is easy to parse and write, it requires manual parsing and
8080validation to ensure that the contents are valid. Moving to a JSON encoded
8181format will allow for easier parsing and validation of the contents, and
82- simplify packaging tools and services.
82+ simplify packaging tools and services by using a consistent format for
83+ distribution metadata.
8384
8485
8586Rationale
@@ -123,19 +124,22 @@ MUST be placed in the same directory as the current email formatted
123124``METADATA `` or ``PKG-INFO `` file.
124125
125126For wheels, this means that ``METADATA.json `` MUST be located in the
126- ``.dist-info `` directory. The wheel format minor version will be incremented to
127- indicate the change in the format.
127+ ``.dist-info `` directory.
128128
129- For source distribution packages , the ``METADATA.json `` file MUST be located
130- in the root directory of the project sources . Tools that prefer the JSON
131- formatted metadata file MUST check for the existence of a `` METADATA.json ``
132- in the source distribution before reading the file.
129+ If present , the ``METADATA.json `` file MUST be located in the root directory of
130+ the project sources in a source distribution package . Tools that prefer the
131+ JSON formatted metadata file MUST NOT assume the presence of the
132+ `` METADATA.json `` file in the source distribution before reading the file.
133133
134134The semantic contents of the ``METADATA `` and ``METADATA.json `` files MUST be
135135equivalent if ``METADATA.json `` is present. Installers MAY verify this
136136information. Public package indexes SHOULD verify the files are semantically
137137equivalent.
138138
139+ The new ``METADATA.json `` file MUST be included in the
140+ :ref: `installed project metadata <packaging:recording-installed-packages >`,
141+ if present in the distribution metadata.
142+
139143Conversion of ``METADATA `` to JSON Encoding
140144-------------------------------------------
141145
@@ -200,7 +204,9 @@ A new optional but recommended file ``WHEEL.json`` shall be introduced as a
200204JSON encoded version of the ``WHEEL `` file. If generated, the ``WHEEL.json ``
201205file MUST be placed in the same directory as the current key-value formatted
202206``WHEEL `` file, i.e. the ``.dist-info `` directory. The semantic contents of
203- the ``WHEEL `` and ``WHEEL.json `` files MUST be equivalent.
207+ the ``WHEEL `` and ``WHEEL.json `` files MUST be equivalent. The wheel file
208+ format version will be incremented to ``1.1 `` to reflect the introduction
209+ of ``WHEEL.json ``.
204210
205211The ``WHEEL.json `` file SHOULD be preferred over the ``WHEEL `` file when both
206212are present.
0 commit comments