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 (still in draft).

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)']