Important
This PEP is a historical document. The up-to-date, canonical spec,Core metadata specifications, is maintained on thePyPA specs page.
×
See thePyPA specification update process for how to propose changes.
This PEP describes a mechanism for adding metadata to Pythonpackages. It includes specifics of the field names, and theirsemantics and usage.
This document specifies version 1.1 of the metadata format.Version 1.0 is specified inPEP 241.
The Distutilssdist command will extract the metadata fieldsfrom the arguments and write them to a file in the generatedzipfile or tarball. This file will be named PKG-INFO and will beplaced in the top directory of the source distribution (where theREADME, INSTALL, and other files usually go).
Developers may not provide their own PKG-INFO file. Thesdistcommand will, if it detects an existing PKG-INFO file, terminatewith an appropriate error message. This should prevent confusioncaused by the PKG-INFO and setup.py files being out of sync.
The PKG-INFO file format is a single set ofRFC 822 headersparseable by the rfc822.py module. The field names listed in thefollowing section are used as the header names.
This section specifies the names and semantics of each of thesupported metadata fields.
Fields marked with “(Multiple use)” may be specified multipletimes in a single PKG-INFO file. Other fields may only occuronce in a PKG-INFO file. Fields marked with “(optional)” arenot required to appear in a valid PKG-INFO file; all otherfields must be present.
Version of the file format; currently “1.0” and “1.1” are theonly legal values here.
Example:
Metadata-Version:1.1
The name of the package.
Example:
Name:BeagleVote
A string containing the package’s version number. Thisfield should be parseable by one of the Version classes(StrictVersion or LooseVersion) in the distutils.versionmodule.
Example:
Version:1.0a2
A comma-separated list of platform specifications, summarizingthe operating systems supported by the package which are notlisted in the “Operating System” Trove classifiers. See“Classifier” below.
Example:
Platform:ObscureUnix,RareDOS
Binary distributions containing a PKG-INFO file will use theSupported-Platform field in their metadata to specify the OS andCPU for which the binary package was compiled. The semantics ofthe Supported-Platform field are not specified in this PEP.
Example:
Supported-Platform:RedHat7.2Supported-Platform:i386-win32-2791
A one-line summary of what the package does.
Example:
Summary:Amoduleforcollectingvotesfrombeagles.
A longer description of the package that can run to severalparagraphs. Software that deals with metadata should not assumeany maximum size for this field, though people shouldn’t includetheir instruction manual as the description.
The contents of this field can be written using reStructuredTextmarkup[1]. For programs that work with the metadata,supporting markup is optional; programs can also display thecontents of the field as-is. This means that authors should beconservative in the markup they use.
Example:
Description:Thismodulecollectsvotesfrombeaglesinordertodeterminetheirelectoralwishes.Do*not*trytousethismodulewithbassethounds;itmakesthemgrumpy.
A list of additional keywords to be used to assist searchingfor the package in a larger catalog.
Example:
Keywords:dogpuppyvotingelection
A string containing the URL for the package’s home page.
Example:
Home-page:http://www.example.com/~cschultz/bvote/
A string containing the URL from which this version of the packagecan be downloaded. (This means that the URL can’t be something like“…/package-latest.tgz”, but instead must be “../package-0.45.tgz”.)
A string containing the author’s name at a minimum; additionalcontact information may be provided.
Example:
Author:C.Schultz,UniversalFeaturesSyndicate,LosAngeles,CA<cschultz@peanuts.example.com>
A string containing the author’s e-mail address. It can containa name and e-mail address in the legal forms for aRFC 822‘From:’ header. It’s not optional because cataloging systemscan use the e-mail portion of this field as a unique keyrepresenting the author. A catalog might provide authors theability to store their GPG key, personal home page, and otheradditional metadataabout the author, and optionally theability to associate several e-mail addresses with the sameperson. Author-related metadata fields are not covered by thisPEP.
Example:
Author-email:"C. Schultz"<cschultz@example.com>
Text indicating the license covering the package where the licenseis not a selection from the “License” Trove classifiers. See“Classifier” below.
Example:
License:Thissoftwaremayonlybeobtainedbysendingtheauthorapostcard,andthentheuserpromisesnottoredistributeit.
Each entry is a string giving a single classification valuefor the package. Classifiers are described inPEP 301.
Examples:
Classifier:DevelopmentStatus::4-BetaClassifier:Environment::Console(TextBased)
Each entry contains a string describing some other module orpackage required by this package.
The format of a requirement string is identical to that of amodule or package name usable with the ‘import’ statement,optionally followed by a version declaration within parentheses.
A version declaration is a series of conditional operators andversion numbers, separated by commas. Conditional operatorsmust be one of “<”, “>”, “<=”, “>=”, “==”, and “!=”. Versionnumbers must be in the format accepted by thedistutils.version.StrictVersion class: two or threedot-separated numeric components, with an optional “pre-release”tag on the end consisting of the letter ‘a’ or ‘b’ followed by anumber. Example version numbers are “1.0”, “2.3a2”, “1.3.99”,
Any number of conditional operators can be specified, e.g.the string “>1.0, !=1.3.4, <2.0” is a legal version declaration.
All of the following are possible requirement strings: “rfc822”,“zlib (>=1.1.4)”, “zope”.
There’s no canonical list of what strings should be used; thePython community is left to choose its own standards.
Example:
Requires:reRequires:sysRequires:zlibRequires:xml.parsers.expat(>1.0)Requires:psycopg
Each entry contains a string describing a package or module thatwill be provided by this package once it is installed. Thesestrings should match the ones used in Requirements fields. Aversion declaration may be supplied (without a comparisonoperator); the package’s version number will be implied if noneis specified.
Example:
Provides:xmlProvides:xml.utilsProvides:xml.utils.iso8601Provides:xml.domProvides:xmltools(1.3)
Each entry contains a string describing a package or modulethat this package renders obsolete, meaning that the two packagesshould not be installed at the same time. Version declarationscan be supplied.
The most common use of this field will be in case a package namechanges, e.g. Gorgon 2.3 gets subsumed into Torqued Python 1.0.When you install Torqued Python, the Gorgon package should beremoved.
Example:
Obsoletes:Gorgon
None.
None.
This document has been placed in the public domain.
Source:https://github.com/python/peps/blob/main/peps/pep-0314.rst
Last modified:2025-02-01 08:55:40 GMT