You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Doc/library/importlib.metadata.rst
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -224,6 +224,9 @@ Distribution metadata
224
224
Raises :exc:`PackageNotFoundError` if the named distribution
225
225
package is not installed in the current Python environment.
226
226
227
+
Raises :exc:`MetadataNotFound` if a distribution package is
228
+
present but no METADATA file is present.
229
+
227
230
.. class:: PackageMetadata
228
231
229
232
A concrete implementation of the
@@ -252,6 +255,12 @@ all the metadata in a JSON-compatible form per :PEP:`566`::
252
255
The full set of available metadata is not described here.
253
256
See the PyPA `Core metadata specification <https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata>`_ for additional details.
254
257
258
+
.. versionchanged:: 3.15
259
+
Previously and incidentally, if a METADATA file was missing from a distribution, an
260
+
empty ``PackageMetadata`` would be returned, indistinguishable from
261
+
an empty METADATA file. Now, a missing METADATA file triggers a
262
+
``MetadataNotFound`` exception.
263
+
255
264
.. versionchanged:: 3.10
256
265
The ``Description`` is now included in the metadata when presented
257
266
through the payload. Line continuation characters have been removed.
@@ -465,6 +474,9 @@ The same applies for :func:`entry_points` and :func:`files`.
465
474
.. attribute:: metadata
466
475
:type: PackageMetadata
467
476
477
+
Raises :exc:`MetadataNotFound` if the METADATA file is not present in
478
+
the distribution.
479
+
468
480
There are all kinds of additional metadata available on :class:`!Distribution`
469
481
instances as a :class:`PackageMetadata` instance::
0 commit comments