Metadata Versions¶
The allowed PKG-INFO fields and their semantics are defined in a series
of PEPs, each of which updates the metadata version field.
Metadata version 1.0 is specified in PEP 241.
Metadata version 1.1 is specified in PEP 314.
Metadata version 1.2 is specified in PEP 345.
Metadata version 2.0 was proposed in PEP 426. (eventually withdrawn)
Metadata version 2.1 was proposed in PEP 566.
Metadata version 2.2 was proposed in PEP 643.
Metadata version 2.3 was proposed in PEP 685.
Metadata version 2.4 was proposed in PEP 639. (long approval cycle)
Metadata version 2.5 was proposed in PEP 794.
A given Distribution object parses / exposes the attributes which
correspond to the metadata version specified in its PKG-INFO.
You can override the metadata version stored in a given distribution by passing the specific version (as a string) to its constructor. E.g., updating the metadata version here in order to expose the classifiers, which were not defined under version ‘1.0’:
>>> from pkginfo import SDist
>>> mypackage = SDist('docs/examples/mypackage-0.1.tar.gz',
... metadata_version='1.1')
>>> print([str(x) for x in mypackage.classifiers])
['Development Status :: 4 - Beta', 'Environment :: Console (Text Based)']