CINXE.COM

PEP 345 – Metadata for Python Software Packages 1.2 | peps.python.org

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="color-scheme" content="light dark"> <title>PEP 345 – Metadata for Python Software Packages 1.2 | peps.python.org</title> <link rel="shortcut icon" href="../_static/py.png"> <link rel="canonical" href="https://peps.python.org/pep-0345/"> <link rel="stylesheet" href="../_static/style.css" type="text/css"> <link rel="stylesheet" href="../_static/mq.css" type="text/css"> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" media="(prefers-color-scheme: light)" id="pyg-light"> <link rel="stylesheet" href="../_static/pygments_dark.css" type="text/css" media="(prefers-color-scheme: dark)" id="pyg-dark"> <link rel="alternate" type="application/rss+xml" title="Latest PEPs" href="https://peps.python.org/peps.rss"> <meta property="og:title" content='PEP 345 – Metadata for Python Software Packages 1.2 | peps.python.org'> <meta property="og:description" content="This PEP describes a mechanism for adding metadata to Python distributions. It includes specifics of the field names, and their semantics and usage."> <meta property="og:type" content="website"> <meta property="og:url" content="https://peps.python.org/pep-0345/"> <meta property="og:site_name" content="Python Enhancement Proposals (PEPs)"> <meta property="og:image" content="https://peps.python.org/_static/og-image.png"> <meta property="og:image:alt" content="Python PEPs"> <meta property="og:image:width" content="200"> <meta property="og:image:height" content="200"> <meta name="description" content="This PEP describes a mechanism for adding metadata to Python distributions. It includes specifics of the field names, and their semantics and usage."> <meta name="theme-color" content="#3776ab"> </head> <body> <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> <symbol id="svg-sun-half" viewBox="0 0 24 24" pointer-events="all"> <title>Following system colour scheme</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <circle cx="12" cy="12" r="9"></circle> <path d="M12 3v18m0-12l4.65-4.65M12 14.3l7.37-7.37M12 19.6l8.85-8.85"></path> </svg> </symbol> <symbol id="svg-moon" viewBox="0 0 24 24" pointer-events="all"> <title>Selected dark colour scheme</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z"></path> </svg> </symbol> <symbol id="svg-sun" viewBox="0 0 24 24" pointer-events="all"> <title>Selected light colour scheme</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <circle cx="12" cy="12" r="5"></circle> <line x1="12" y1="1" x2="12" y2="3"></line> <line x1="12" y1="21" x2="12" y2="23"></line> <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> <line x1="1" y1="12" x2="3" y2="12"></line> <line x1="21" y1="12" x2="23" y2="12"></line> <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> </svg> </symbol> </svg> <script> document.documentElement.dataset.colour_scheme = localStorage.getItem("colour_scheme") || "auto" </script> <section id="pep-page-section"> <header> <h1>Python Enhancement Proposals</h1> <ul class="breadcrumbs"> <li><a href="https://www.python.org/" title="The Python Programming Language">Python</a> &raquo; </li> <li><a href="../pep-0000/">PEP Index</a> &raquo; </li> <li>PEP 345</li> </ul> <button id="colour-scheme-cycler" onClick="setColourScheme(nextColourScheme())"> <svg aria-hidden="true" class="colour-scheme-icon-when-auto"><use href="#svg-sun-half"></use></svg> <svg aria-hidden="true" class="colour-scheme-icon-when-dark"><use href="#svg-moon"></use></svg> <svg aria-hidden="true" class="colour-scheme-icon-when-light"><use href="#svg-sun"></use></svg> <span class="visually-hidden">Toggle light / dark / auto colour theme</span> </button> </header> <article> <section id="pep-content"> <h1 class="page-title">PEP 345 – Metadata for Python Software Packages 1.2</h1> <dl class="rfc2822 field-list simple"> <dt class="field-odd">Author<span class="colon">:</span></dt> <dd class="field-odd">Richard Jones &lt;richard&#32;&#97;t&#32;python.org&gt;</dd> <dt class="field-even">Discussions-To<span class="colon">:</span></dt> <dd class="field-even"><a class="reference external" href="https://mail.python.org/archives/list/distutils-sig&#64;python.org/">Distutils-SIG list</a></dd> <dt class="field-odd">Status<span class="colon">:</span></dt> <dd class="field-odd"><abbr title="Replaced by another succeeding PEP">Superseded</abbr></dd> <dt class="field-even">Type<span class="colon">:</span></dt> <dd class="field-even"><abbr title="Normative PEP with a new feature for Python, implementation change for CPython or interoperability standard for the ecosystem">Standards Track</abbr></dd> <dt class="field-odd">Topic<span class="colon">:</span></dt> <dd class="field-odd"><a class="reference external" href="../topic/packaging/">Packaging</a></dd> <dt class="field-even">Created<span class="colon">:</span></dt> <dd class="field-even">28-Apr-2005</dd> <dt class="field-odd">Python-Version<span class="colon">:</span></dt> <dd class="field-odd">2.7</dd> <dt class="field-even">Post-History<span class="colon">:</span></dt> <dd class="field-even"><a class="reference external" href="https://mail.python.org/archives/list/python-dev&#64;python.org/thread/5QWS2FXKZNNPKNZO6RLPGT5NORS5ZQ2V/" title="Python-Dev thread">22-Dec-2009</a></dd> <dt class="field-odd">Replaces<span class="colon">:</span></dt> <dd class="field-odd"><a class="reference external" href="../pep-0314/">314</a></dd> <dt class="field-even">Superseded-By<span class="colon">:</span></dt> <dd class="field-even"><a class="reference external" href="../pep-0566/">566</a></dd> <dt class="field-odd">Resolution<span class="colon">:</span></dt> <dd class="field-odd"><a class="reference external" href="https://mail.python.org/archives/list/python-dev&#64;python.org/thread/MKHXVV746H7ZDFN62Z72VNAX6KIRXNRO/">Python-Dev thread</a></dd> </dl> <hr class="docutils" /> <section id="contents"> <details><summary>Table of Contents</summary><ul class="simple"> <li><a class="reference internal" href="#abstract">Abstract</a></li> <li><a class="reference internal" href="#fields">Fields</a><ul> <li><a class="reference internal" href="#metadata-version">Metadata-Version</a></li> <li><a class="reference internal" href="#name">Name</a></li> <li><a class="reference internal" href="#version">Version</a></li> <li><a class="reference internal" href="#platform-multiple-use">Platform (multiple use)</a></li> <li><a class="reference internal" href="#supported-platform-multiple-use">Supported-Platform (multiple use)</a></li> <li><a class="reference internal" href="#summary">Summary</a></li> <li><a class="reference internal" href="#description-optional">Description (optional)</a></li> <li><a class="reference internal" href="#keywords-optional">Keywords (optional)</a></li> <li><a class="reference internal" href="#home-page-optional">Home-page (optional)</a></li> <li><a class="reference internal" href="#download-url">Download-URL</a></li> <li><a class="reference internal" href="#author-optional">Author (optional)</a></li> <li><a class="reference internal" href="#author-email-optional">Author-email (optional)</a></li> <li><a class="reference internal" href="#maintainer-optional">Maintainer (optional)</a></li> <li><a class="reference internal" href="#maintainer-email-optional">Maintainer-email (optional)</a></li> <li><a class="reference internal" href="#license-optional">License (optional)</a></li> <li><a class="reference internal" href="#classifier-multiple-use">Classifier (multiple use)</a></li> <li><a class="reference internal" href="#requires-dist-multiple-use">Requires-Dist (multiple use)</a></li> <li><a class="reference internal" href="#provides-dist-multiple-use">Provides-Dist (multiple use)</a></li> <li><a class="reference internal" href="#obsoletes-dist-multiple-use">Obsoletes-Dist (multiple use)</a></li> <li><a class="reference internal" href="#requires-python">Requires-Python</a></li> <li><a class="reference internal" href="#requires-external-multiple-use">Requires-External (multiple use)</a></li> <li><a class="reference internal" href="#project-url-multiple-use">Project-URL (multiple-use)</a></li> </ul> </li> <li><a class="reference internal" href="#version-specifiers">Version Specifiers</a></li> <li><a class="reference internal" href="#environment-markers">Environment markers</a></li> <li><a class="reference internal" href="#summary-of-differences-from-pep-314">Summary of Differences From PEP 314</a></li> <li><a class="reference internal" href="#references">References</a></li> <li><a class="reference internal" href="#copyright">Copyright</a></li> <li><a class="reference internal" href="#acknowledgements">Acknowledgements</a></li> </ul> </details></section> <div class="pep-banner canonical-pypa-spec sticky-banner admonition important"> <p class="admonition-title">Important</p> <p>This PEP is a historical document. The up-to-date, canonical spec, <a class="reference external" href="https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata" title="(in Python Packaging User Guide)"><span>Core metadata specifications</span></a>, is maintained on the <a class="reference external" href="https://packaging.python.org/en/latest/specifications/">PyPA specs page</a>.</p> <p class="close-button">×</p> <p>See the <a class="reference external" href="https://www.pypa.io/en/latest/specifications/#handling-fixes-and-other-minor-updates">PyPA specification update process</a> for how to propose changes.</p> </div> <section id="abstract"> <h2><a class="toc-backref" href="#abstract" role="doc-backlink">Abstract</a></h2> <p>This PEP describes a mechanism for adding metadata to Python distributions. It includes specifics of the field names, and their semantics and usage.</p> <p>This document specifies version 1.2 of the metadata format. Version 1.0 is specified in <a class="pep reference internal" href="../pep-0241/" title="PEP 241 – Metadata for Python Software Packages">PEP 241</a>. Version 1.1 is specified in <a class="pep reference internal" href="../pep-0314/" title="PEP 314 – Metadata for Python Software Packages 1.1">PEP 314</a>.</p> <p>Version 1.2 of the metadata format adds a number of optional fields designed to make third-party packaging of Python Software easier. These fields are “Requires-Python”, “Requires-External”, “Requires-Dist”, “Provides-Dist”, and “Obsoletes-Dist”. This version also changes the “Platform” field. Three new fields were also added: “Maintainer”, “Maintainer-email” and “Project-URL”.</p> <p>Last, this new version also adds <code class="docutils literal notranslate"><span class="pre">environment</span> <span class="pre">markers</span></code>.</p> </section> <section id="fields"> <h2><a class="toc-backref" href="#fields" role="doc-backlink">Fields</a></h2> <p>This section specifies the names and semantics of each of the supported metadata fields.</p> <p>Fields marked with “(Multiple use)” may be specified multiple times in a single PKG-INFO file. Other fields may only occur once in a PKG-INFO file. Fields marked with “(optional)” are not required to appear in a valid PKG-INFO file; all other fields must be present.</p> <section id="metadata-version"> <h3><a class="toc-backref" href="#metadata-version" role="doc-backlink">Metadata-Version</a></h3> <p>Version of the file format; “1.2” is the only legal value.</p> <p>Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Metadata</span><span class="o">-</span><span class="n">Version</span><span class="p">:</span> <span class="mf">1.2</span> </pre></div> </div> </section> <section id="name"> <h3><a class="toc-backref" href="#name" role="doc-backlink">Name</a></h3> <p>The name of the distributions.</p> <p>Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Name</span><span class="p">:</span> <span class="n">BeagleVote</span> </pre></div> </div> </section> <section id="version"> <h3><a class="toc-backref" href="#version" role="doc-backlink">Version</a></h3> <p>A string containing the distribution’s version number. This field must be in the format specified in <a class="pep reference internal" href="../pep-0440/" title="PEP 440 – Version Identification and Dependency Specification">PEP 440</a>.</p> <p>Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Version</span><span class="p">:</span> <span class="mf">1.0</span><span class="n">a2</span> </pre></div> </div> </section> <section id="platform-multiple-use"> <h3><a class="toc-backref" href="#platform-multiple-use" role="doc-backlink">Platform (multiple use)</a></h3> <p>A Platform specification describing an operating system supported by the distribution which is not listed in the “Operating System” Trove classifiers. See “Classifier” below.</p> <p>Examples:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Platform</span><span class="p">:</span> <span class="n">ObscureUnix</span> <span class="n">Platform</span><span class="p">:</span> <span class="n">RareDOS</span> </pre></div> </div> </section> <section id="supported-platform-multiple-use"> <h3><a class="toc-backref" href="#supported-platform-multiple-use" role="doc-backlink">Supported-Platform (multiple use)</a></h3> <p>Binary distributions containing a PKG-INFO file will use the Supported-Platform field in their metadata to specify the OS and CPU for which the binary distribution was compiled. The semantics of the Supported-Platform field are not specified in this PEP.</p> <p>Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Supported</span><span class="o">-</span><span class="n">Platform</span><span class="p">:</span> <span class="n">RedHat</span> <span class="mf">7.2</span> <span class="n">Supported</span><span class="o">-</span><span class="n">Platform</span><span class="p">:</span> <span class="n">i386</span><span class="o">-</span><span class="n">win32</span><span class="o">-</span><span class="mi">2791</span> </pre></div> </div> </section> <section id="summary"> <h3><a class="toc-backref" href="#summary" role="doc-backlink">Summary</a></h3> <p>A one-line summary of what the distribution does.</p> <p>Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Summary</span><span class="p">:</span> <span class="n">A</span> <span class="n">module</span> <span class="k">for</span> <span class="n">collecting</span> <span class="n">votes</span> <span class="kn">from</span><span class="w"> </span><span class="nn">beagles.</span> </pre></div> </div> </section> <section id="description-optional"> <h3><a class="toc-backref" href="#description-optional" role="doc-backlink">Description (optional)</a></h3> <p>A longer description of the distribution that can run to several paragraphs. Software that deals with metadata should not assume any maximum size for this field, though people shouldn’t include their instruction manual as the description.</p> <p>The contents of this field can be written using reStructuredText markup <a class="footnote-reference brackets" href="#id2" id="id1">[1]</a>. For programs that work with the metadata, supporting markup is optional; programs can also display the contents of the field as-is. This means that authors should be conservative in the markup they use.</p> <p>To support empty lines and lines with indentation with respect to the <span class="target" id="index-0"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc822.html"><strong>RFC 822</strong></a> format, any CRLF character has to be suffixed by 7 spaces followed by a pipe (“|”) char. As a result, the Description field is encoded into a folded field that can be interpreted by <span class="target" id="index-1"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc822.html#section-3.1.1"><strong>RFC 822#section-3.1.1</strong></a> parser.</p> <p>Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>Description: This project provides powerful math functions |For example, you can use ``sum()`` to sum numbers: | |Example:: | | &gt;&gt;&gt; sum(1, 2) | 3 | </pre></div> </div> <p>This encoding implies that any occurrences of a CRLF followed by 7 spaces and a pipe char have to be replaced by a single CRLF when the field is unfolded using a <span class="target" id="index-2"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc822.html"><strong>RFC 822</strong></a> reader.</p> </section> <section id="keywords-optional"> <h3><a class="toc-backref" href="#keywords-optional" role="doc-backlink">Keywords (optional)</a></h3> <p>A list of additional keywords to be used to assist searching for the distribution in a larger catalog.</p> <p>Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Keywords</span><span class="p">:</span> <span class="n">dog</span> <span class="n">puppy</span> <span class="n">voting</span> <span class="n">election</span> </pre></div> </div> </section> <section id="home-page-optional"> <h3><a class="toc-backref" href="#home-page-optional" role="doc-backlink">Home-page (optional)</a></h3> <p>A string containing the URL for the distribution’s home page.</p> <p>Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Home</span><span class="o">-</span><span class="n">page</span><span class="p">:</span> <span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">www</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span><span class="o">/~</span><span class="n">cschultz</span><span class="o">/</span><span class="n">bvote</span><span class="o">/</span> </pre></div> </div> </section> <section id="download-url"> <h3><a class="toc-backref" href="#download-url" role="doc-backlink">Download-URL</a></h3> <p>A string containing the URL from which this version of the distribution can be downloaded. (This means that the URL can’t be something like “…/BeagleVote-latest.tgz”, but instead must be “…/BeagleVote-0.45.tgz”.)</p> </section> <section id="author-optional"> <h3><a class="toc-backref" href="#author-optional" role="doc-backlink">Author (optional)</a></h3> <p>A string containing the author’s name at a minimum; additional contact information may be provided.</p> <p>Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Author</span><span class="p">:</span> <span class="n">C</span><span class="o">.</span> <span class="n">Schultz</span><span class="p">,</span> <span class="n">Universal</span> <span class="n">Features</span> <span class="n">Syndicate</span><span class="p">,</span> <span class="n">Los</span> <span class="n">Angeles</span><span class="p">,</span> <span class="n">CA</span> <span class="o">&lt;</span><span class="n">cschultz</span><span class="nd">@peanuts</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span><span class="o">&gt;</span> </pre></div> </div> </section> <section id="author-email-optional"> <h3><a class="toc-backref" href="#author-email-optional" role="doc-backlink">Author-email (optional)</a></h3> <p>A string containing the author’s e-mail address. It can contain a name and e-mail address in the legal forms for a <span class="target" id="index-3"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc822.html"><strong>RFC 822</strong></a> <code class="docutils literal notranslate"><span class="pre">From:</span></code> header.</p> <p>Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Author</span><span class="o">-</span><span class="n">email</span><span class="p">:</span> <span class="s2">&quot;C. Schultz&quot;</span> <span class="o">&lt;</span><span class="n">cschultz</span><span class="nd">@example</span><span class="o">.</span><span class="n">com</span><span class="o">&gt;</span> </pre></div> </div> </section> <section id="maintainer-optional"> <h3><a class="toc-backref" href="#maintainer-optional" role="doc-backlink">Maintainer (optional)</a></h3> <p>A string containing the maintainer’s name at a minimum; additional contact information may be provided.</p> <p>Note that this field is intended for use when a project is being maintained by someone other than the original author: it should be omitted if it is identical to <code class="docutils literal notranslate"><span class="pre">Author</span></code>.</p> <p>Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Maintainer</span><span class="p">:</span> <span class="n">C</span><span class="o">.</span> <span class="n">Schultz</span><span class="p">,</span> <span class="n">Universal</span> <span class="n">Features</span> <span class="n">Syndicate</span><span class="p">,</span> <span class="n">Los</span> <span class="n">Angeles</span><span class="p">,</span> <span class="n">CA</span> <span class="o">&lt;</span><span class="n">cschultz</span><span class="nd">@peanuts</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">com</span><span class="o">&gt;</span> </pre></div> </div> </section> <section id="maintainer-email-optional"> <h3><a class="toc-backref" href="#maintainer-email-optional" role="doc-backlink">Maintainer-email (optional)</a></h3> <p>A string containing the maintainer’s e-mail address. It can contain a name and e-mail address in the legal forms for a <span class="target" id="index-4"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc822.html"><strong>RFC 822</strong></a> <code class="docutils literal notranslate"><span class="pre">From:</span></code> header.</p> <p>Note that this field is intended for use when a project is being maintained by someone other than the original author: it should be omitted if it is identical to <code class="docutils literal notranslate"><span class="pre">Author-email</span></code>.</p> <p>Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Maintainer</span><span class="o">-</span><span class="n">email</span><span class="p">:</span> <span class="s2">&quot;C. Schultz&quot;</span> <span class="o">&lt;</span><span class="n">cschultz</span><span class="nd">@example</span><span class="o">.</span><span class="n">com</span><span class="o">&gt;</span> </pre></div> </div> </section> <section id="license-optional"> <h3><a class="toc-backref" href="#license-optional" role="doc-backlink">License (optional)</a></h3> <p>Text indicating the license covering the distribution where the license is not a selection from the “License” Trove classifiers. See “Classifier” below. This field may also be used to specify a particular version of a license which is named via the <code class="docutils literal notranslate"><span class="pre">Classifier</span></code> field, or to indicate a variation or exception to such a license.</p> <p>Examples:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">License</span><span class="p">:</span> <span class="n">This</span> <span class="n">software</span> <span class="n">may</span> <span class="n">only</span> <span class="n">be</span> <span class="n">obtained</span> <span class="n">by</span> <span class="n">sending</span> <span class="n">the</span> <span class="n">author</span> <span class="n">a</span> <span class="n">postcard</span><span class="p">,</span> <span class="ow">and</span> <span class="n">then</span> <span class="n">the</span> <span class="n">user</span> <span class="n">promises</span> <span class="ow">not</span> <span class="n">to</span> <span class="n">redistribute</span> <span class="n">it</span><span class="o">.</span> <span class="n">License</span><span class="p">:</span> <span class="n">GPL</span> <span class="n">version</span> <span class="mi">3</span><span class="p">,</span> <span class="n">excluding</span> <span class="n">DRM</span> <span class="n">provisions</span> </pre></div> </div> </section> <section id="classifier-multiple-use"> <h3><a class="toc-backref" href="#classifier-multiple-use" role="doc-backlink">Classifier (multiple use)</a></h3> <p>Each entry is a string giving a single classification value for the distribution. Classifiers are described in <a class="pep reference internal" href="../pep-0301/" title="PEP 301 – Package Index and Metadata for Distutils">PEP 301</a>.</p> <p>Examples:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Classifier</span><span class="p">:</span> <span class="n">Development</span> <span class="n">Status</span> <span class="p">::</span> <span class="mi">4</span> <span class="o">-</span> <span class="n">Beta</span> <span class="n">Classifier</span><span class="p">:</span> <span class="n">Environment</span> <span class="p">::</span> <span class="n">Console</span> <span class="p">(</span><span class="n">Text</span> <span class="n">Based</span><span class="p">)</span> </pre></div> </div> </section> <section id="requires-dist-multiple-use"> <h3><a class="toc-backref" href="#requires-dist-multiple-use" role="doc-backlink">Requires-Dist (multiple use)</a></h3> <p>Each entry contains a string naming some other distutils project required by this distribution.</p> <p>The format of a requirement string is identical to that of a distutils project name (e.g., as found in the <code class="docutils literal notranslate"><span class="pre">Name:</span></code> field. optionally followed by a version declaration within parentheses.</p> <p>The distutils project names should correspond to names as found on the <a class="reference external" href="http://pypi.python.org/pypi/">Python Package Index</a>.</p> <p>Version declarations must follow the rules described in <a class="reference internal" href="#version-specifiers">Version Specifiers</a></p> <p>Examples:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Requires</span><span class="o">-</span><span class="n">Dist</span><span class="p">:</span> <span class="n">pkginfo</span> <span class="n">Requires</span><span class="o">-</span><span class="n">Dist</span><span class="p">:</span> <span class="n">PasteDeploy</span> <span class="n">Requires</span><span class="o">-</span><span class="n">Dist</span><span class="p">:</span> <span class="n">zope</span><span class="o">.</span><span class="n">interface</span> <span class="p">(</span><span class="o">&gt;</span><span class="mf">3.5.0</span><span class="p">)</span> </pre></div> </div> </section> <section id="provides-dist-multiple-use"> <h3><a class="toc-backref" href="#provides-dist-multiple-use" role="doc-backlink">Provides-Dist (multiple use)</a></h3> <p>Each entry contains a string naming a Distutils project which is contained within this distribution. This field <em>must</em> include the project identified in the <code class="docutils literal notranslate"><span class="pre">Name</span></code> field, followed by the version : Name (Version).</p> <p>A distribution may provide additional names, e.g. to indicate that multiple projects have been bundled together. For instance, source distributions of the <code class="docutils literal notranslate"><span class="pre">ZODB</span></code> project have historically included the <code class="docutils literal notranslate"><span class="pre">transaction</span></code> project, which is now available as a separate distribution. Installing such a source distribution satisfies requirements for both <code class="docutils literal notranslate"><span class="pre">ZODB</span></code> and <code class="docutils literal notranslate"><span class="pre">transaction</span></code>.</p> <p>A distribution may also provide a “virtual” project name, which does not correspond to any separately-distributed project: such a name might be used to indicate an abstract capability which could be supplied by one of multiple projects. E.g., multiple projects might supply RDBMS bindings for use by a given ORM: each project might declare that it provides <code class="docutils literal notranslate"><span class="pre">ORM-bindings</span></code>, allowing other projects to depend only on having at most one of them installed.</p> <p>A version declaration may be supplied and must follow the rules described in <a class="reference internal" href="#version-specifiers">Version Specifiers</a>. The distribution’s version number will be implied if none is specified.</p> <p>Examples:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Provides</span><span class="o">-</span><span class="n">Dist</span><span class="p">:</span> <span class="n">OtherProject</span> <span class="n">Provides</span><span class="o">-</span><span class="n">Dist</span><span class="p">:</span> <span class="n">AnotherProject</span> <span class="p">(</span><span class="mf">3.4</span><span class="p">)</span> <span class="n">Provides</span><span class="o">-</span><span class="n">Dist</span><span class="p">:</span> <span class="n">virtual_package</span> </pre></div> </div> </section> <section id="obsoletes-dist-multiple-use"> <h3><a class="toc-backref" href="#obsoletes-dist-multiple-use" role="doc-backlink">Obsoletes-Dist (multiple use)</a></h3> <p>Each entry contains a string describing a distutils project’s distribution which this distribution renders obsolete, meaning that the two projects should not be installed at the same time.</p> <p>Version declarations can be supplied. Version numbers must be in the format specified in <a class="reference internal" href="#version-specifiers">Version Specifiers</a>.</p> <p>The most common use of this field will be in case a project name changes, e.g. Gorgon 2.3 gets subsumed into Torqued Python 1.0. When you install Torqued Python, the Gorgon distribution should be removed.</p> <p>Examples:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Obsoletes</span><span class="o">-</span><span class="n">Dist</span><span class="p">:</span> <span class="n">Gorgon</span> <span class="n">Obsoletes</span><span class="o">-</span><span class="n">Dist</span><span class="p">:</span> <span class="n">OtherProject</span> <span class="p">(</span><span class="o">&lt;</span><span class="mf">3.0</span><span class="p">)</span> </pre></div> </div> </section> <section id="requires-python"> <h3><a class="toc-backref" href="#requires-python" role="doc-backlink">Requires-Python</a></h3> <p>This field specifies the Python version(s) that the distribution is guaranteed to be compatible with.</p> <p>Version numbers must be in the format specified in <a class="reference internal" href="#version-specifiers">Version Specifiers</a>.</p> <p>Examples:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Requires</span><span class="o">-</span><span class="n">Python</span><span class="p">:</span> <span class="mf">2.5</span> <span class="n">Requires</span><span class="o">-</span><span class="n">Python</span><span class="p">:</span> <span class="o">&gt;</span><span class="mf">2.1</span> <span class="n">Requires</span><span class="o">-</span><span class="n">Python</span><span class="p">:</span> <span class="o">&gt;=</span><span class="mf">2.3.4</span> <span class="n">Requires</span><span class="o">-</span><span class="n">Python</span><span class="p">:</span> <span class="o">&gt;=</span><span class="mf">2.5</span><span class="p">,</span><span class="o">&lt;</span><span class="mf">2.7</span> </pre></div> </div> </section> <section id="requires-external-multiple-use"> <h3><a class="toc-backref" href="#requires-external-multiple-use" role="doc-backlink">Requires-External (multiple use)</a></h3> <p>Each entry contains a string describing some dependency in the system that the distribution is to be used. This field is intended to serve as a hint to downstream project maintainers, and has no semantics which are meaningful to the <code class="docutils literal notranslate"><span class="pre">distutils</span></code> distribution.</p> <p>The format of a requirement string is a name of an external dependency, optionally followed by a version declaration within parentheses.</p> <p>Because they refer to non-Python software releases, version numbers for this field are <strong>not</strong> required to conform to the format specified in <a class="pep reference internal" href="../pep-0440/" title="PEP 440 – Version Identification and Dependency Specification">PEP 440</a>: they should correspond to the version scheme used by the external dependency.</p> <p>Notice that there’s is no particular rule on the strings to be used.</p> <p>Examples:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Requires</span><span class="o">-</span><span class="n">External</span><span class="p">:</span> <span class="n">C</span> <span class="n">Requires</span><span class="o">-</span><span class="n">External</span><span class="p">:</span> <span class="n">libpng</span> <span class="p">(</span><span class="o">&gt;=</span><span class="mf">1.5</span><span class="p">)</span> </pre></div> </div> </section> <section id="project-url-multiple-use"> <h3><a class="toc-backref" href="#project-url-multiple-use" role="doc-backlink">Project-URL (multiple-use)</a></h3> <p>A string containing an extra URL for the project and a label for it, separated by a comma. This should be used when there are other URLs to list in the metadata in addition to the “Home-page” field.</p> <p>Examples:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Project</span><span class="o">-</span><span class="n">URL</span><span class="p">:</span> <span class="n">Bug</span> <span class="n">Tracker</span><span class="p">,</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">pypa</span><span class="o">/</span><span class="n">setuptools</span><span class="o">/</span><span class="n">issues</span> <span class="n">Project</span><span class="o">-</span><span class="n">URL</span><span class="p">:</span> <span class="n">Documentation</span><span class="p">,</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">setuptools</span><span class="o">.</span><span class="n">readthedocs</span><span class="o">.</span><span class="n">io</span><span class="o">/</span> <span class="n">Project</span><span class="o">-</span><span class="n">URL</span><span class="p">:</span> <span class="n">Funding</span><span class="p">,</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">donate</span><span class="o">.</span><span class="n">pypi</span><span class="o">.</span><span class="n">org</span> </pre></div> </div> <p>The label is free text, with a maximum length of 32 characters. Notice that distributions uploaded to PyPI will have these extra entries displayed under the “Project links” section of their landing page.</p> </section> </section> <section id="version-specifiers"> <h2><a class="toc-backref" href="#version-specifiers" role="doc-backlink">Version Specifiers</a></h2> <p>Version specifiers are a series of conditional operators and version numbers, separated by commas. Conditional operators must be one of “&lt;”, “&gt;”, “&lt;=”, “&gt;=”, “==” and “!=”.</p> <p>Any number of conditional operators can be specified, e.g. the string “&gt;1.0, !=1.3.4, &lt;2.0” is a legal version declaration. The comma (“,”) is equivalent to the <strong>and</strong> operator.</p> <p>Each version number must be in the format specified in <a class="pep reference internal" href="../pep-0440/" title="PEP 440 – Version Identification and Dependency Specification">PEP 440</a>.</p> <p>When a version is provided, it always includes all versions that starts with the same value. For example, the “2.5” version of Python will include versions like “2.5.2” or “2.5.3”. Pre and post releases in that case are excluded. So in our example, versions like “2.5a1” are not included when “2.5” is used. If the first version of the range is required, it has to be explicitly given. In our example, it will be “2.5.0”.</p> <p>Notice that some projects might omit the “.0” suffix for the first release of the “2.5.x” series:</p> <ul class="simple"> <li>2.5</li> <li>2.5.1</li> <li>2.5.2</li> <li>etc.</li> </ul> <p>In that case, “2.5.0” will have to be explicitly used to avoid any confusion between the “2.5” notation that represents the full range. It is a recommended practice to use schemes of the same length for a series to completely avoid this problem.</p> <p>Some Examples:</p> <ul class="simple"> <li><code class="docutils literal notranslate"><span class="pre">Requires-Dist:</span> <span class="pre">zope.interface</span> <span class="pre">(3.1)</span></code>: any version that starts with 3.1, excluding post or pre-releases.</li> <li><code class="docutils literal notranslate"><span class="pre">Requires-Dist:</span> <span class="pre">zope.interface</span> <span class="pre">(3.1.0)</span></code>: any version that starts with 3.1.0, excluding post or pre-releases. Since that particular project doesn’t use more than 3 digits, it also means “only the 3.1.0 release”.</li> <li><code class="docutils literal notranslate"><span class="pre">Requires-Python:</span> <span class="pre">3</span></code>: Any Python 3 version, no matter which one, excluding post or pre-releases.</li> <li><code class="docutils literal notranslate"><span class="pre">Requires-Python:</span> <span class="pre">&gt;=2.6,&lt;3</span></code>: Any version of Python 2.6 or 2.7, including post releases of 2.6, pre and post releases of 2.7. It excludes pre releases of Python 3.</li> <li><code class="docutils literal notranslate"><span class="pre">Requires-Python:</span> <span class="pre">2.6.2</span></code>: Equivalent to “&gt;=2.6.2,&lt;2.6.3”. So this includes only Python 2.6.2. Of course, if Python was numbered with 4 digits, it would have include all versions of the 2.6.2 series.</li> <li><code class="docutils literal notranslate"><span class="pre">Requires-Python:</span> <span class="pre">2.5.0</span></code>: Equivalent to “&gt;=2.5.0,&lt;2.5.1”.</li> <li><code class="docutils literal notranslate"><span class="pre">Requires-Dist:</span> <span class="pre">zope.interface</span> <span class="pre">(3.1,!=3.1.3)</span></code>: any version that starts with 3.1, excluding post or pre-releases of 3.1 <em>and</em> excluding any version that starts with “3.1.3”. For this particular project, this means: “any version of the 3.1 series but not 3.1.3”. This is equivalent to: “&gt;=3.1,!=3.1.3,&lt;3.2”.</li> </ul> </section> <section id="environment-markers"> <h2><a class="toc-backref" href="#environment-markers" role="doc-backlink">Environment markers</a></h2> <p>An <strong>environment marker</strong> is a marker that can be added at the end of a field after a semi-colon (“;”), to add a condition about the execution environment.</p> <p>Here are some example of fields using such markers:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Requires</span><span class="o">-</span><span class="n">Dist</span><span class="p">:</span> <span class="n">pywin32</span> <span class="p">(</span><span class="o">&gt;</span><span class="mf">1.0</span><span class="p">);</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span> <span class="o">==</span> <span class="s1">&#39;win32&#39;</span> <span class="n">Obsoletes</span><span class="o">-</span><span class="n">Dist</span><span class="p">:</span> <span class="n">pywin31</span><span class="p">;</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span> <span class="o">==</span> <span class="s1">&#39;win32&#39;</span> <span class="n">Requires</span><span class="o">-</span><span class="n">Dist</span><span class="p">:</span> <span class="n">foo</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="o">!=</span><span class="mf">1.3</span><span class="p">);</span> <span class="n">platform</span><span class="o">.</span><span class="n">machine</span> <span class="o">==</span> <span class="s1">&#39;i386&#39;</span> <span class="n">Requires</span><span class="o">-</span><span class="n">Dist</span><span class="p">:</span> <span class="n">bar</span><span class="p">;</span> <span class="n">python_version</span> <span class="o">==</span> <span class="s1">&#39;2.4&#39;</span> <span class="ow">or</span> <span class="n">python_version</span> <span class="o">==</span> <span class="s1">&#39;2.5&#39;</span> <span class="n">Requires</span><span class="o">-</span><span class="n">External</span><span class="p">:</span> <span class="n">libxslt</span><span class="p">;</span> <span class="s1">&#39;linux&#39;</span> <span class="ow">in</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span> </pre></div> </div> <p>The micro-language behind this is the simplest possible: it compares only strings, with the <code class="docutils literal notranslate"><span class="pre">==</span></code> and <code class="docutils literal notranslate"><span class="pre">in</span></code> operators (and their opposites), and with the ability to combine expressions. It makes it also easy to understand to non-pythoneers.</p> <p>The pseudo-grammar is</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">EXPR</span> <span class="p">[</span><span class="ow">in</span><span class="o">|==|!=|</span><span class="ow">not</span> <span class="ow">in</span><span class="p">]</span> <span class="n">EXPR</span> <span class="p">[</span><span class="ow">or</span><span class="o">|</span><span class="ow">and</span><span class="p">]</span> <span class="o">...</span> </pre></div> </div> <p>where <code class="docutils literal notranslate"><span class="pre">EXPR</span></code> belongs to any of those:</p> <ul class="simple"> <li>python_version = ‘%s.%s’ % (sys.version_info[0], sys.version_info[1])</li> <li>python_full_version = sys.version.split()[0]</li> <li>os.name = os.name</li> <li>sys.platform = sys.platform</li> <li>platform.version = platform.version()</li> <li>platform.machine = platform.machine()</li> <li>platform.python_implementation = platform.python_implementation()</li> <li>a free string, like <code class="docutils literal notranslate"><span class="pre">'2.4'</span></code>, or <code class="docutils literal notranslate"><span class="pre">'win32'</span></code></li> </ul> <p>Notice that <code class="docutils literal notranslate"><span class="pre">in</span></code> is restricted to strings, meaning that it is not possible to use other sequences like tuples or lists on the right side.</p> <p>The fields that benefit from this marker are:</p> <ul class="simple"> <li>Requires-External</li> <li>Requires-Dist</li> <li>Provides-Dist</li> <li>Obsoletes-Dist</li> <li>Classifier</li> </ul> </section> <section id="summary-of-differences-from-pep-314"> <h2><a class="toc-backref" href="#summary-of-differences-from-pep-314" role="doc-backlink">Summary of Differences From PEP 314</a></h2> <ul class="simple"> <li>Metadata-Version is now 1.2.</li> <li>Added the environment markers.</li> <li>Changed fields:<ul> <li>Platform (syntax change)</li> <li>Author-email (change to optional field)</li> </ul> </li> <li>Added fields:<ul> <li>Maintainer</li> <li>Maintainer-email</li> <li>Requires-Python</li> <li>Requires-External</li> <li>Requires-Dist</li> <li>Provides-Dist</li> <li>Obsoletes-Dist</li> <li>Project-URL</li> </ul> </li> <li>Deprecated fields:<ul> <li>Requires (in favor of Requires-Dist)</li> <li>Provides (in favor of Provides-Dist)</li> <li>Obsoletes (in favor of Obsoletes-Dist)</li> </ul> </li> </ul> </section> <section id="references"> <h2><a class="toc-backref" href="#references" role="doc-backlink">References</a></h2> <p>This document specifies version 1.2 of the metadata format. Version 1.0 is specified in <a class="pep reference internal" href="../pep-0241/" title="PEP 241 – Metadata for Python Software Packages">PEP 241</a>. Version 1.1 is specified in <a class="pep reference internal" href="../pep-0314/" title="PEP 314 – Metadata for Python Software Packages 1.1">PEP 314</a>.</p> <aside class="footnote-list brackets"> <aside class="footnote brackets" id="id2" role="doc-footnote"> <dt class="label" id="id2">[<a href="#id1">1</a>]</dt> <dd>reStructuredText markup: <a class="reference external" href="http://docutils.sourceforge.net/">http://docutils.sourceforge.net/</a></aside> </aside> </section> <section id="copyright"> <h2><a class="toc-backref" href="#copyright" role="doc-backlink">Copyright</a></h2> <p>This document has been placed in the public domain.</p> </section> <section id="acknowledgements"> <h2><a class="toc-backref" href="#acknowledgements" role="doc-backlink">Acknowledgements</a></h2> <p>Fred Drake, Anthony Baxter and Matthias Klose have all contributed to the ideas presented in this PEP.</p> <p>Tres Seaver, Jim Fulton, Marc-André Lemburg, Martin von Löwis, Tarek Ziadé, David Lyon and other people at the Distutils-SIG have contributed to the new updated version.</p> </section> </section> <hr class="docutils" /> <p>Source: <a class="reference external" href="https://github.com/python/peps/blob/main/peps/pep-0345.rst">https://github.com/python/peps/blob/main/peps/pep-0345.rst</a></p> <p>Last modified: <a class="reference external" href="https://github.com/python/peps/commits/main/peps/pep-0345.rst">2025-02-01 08:55:40 GMT</a></p> </article> <nav id="pep-sidebar"> <h2>Contents</h2> <ul> <li><a class="reference internal" href="#abstract">Abstract</a></li> <li><a class="reference internal" href="#fields">Fields</a><ul> <li><a class="reference internal" href="#metadata-version">Metadata-Version</a></li> <li><a class="reference internal" href="#name">Name</a></li> <li><a class="reference internal" href="#version">Version</a></li> <li><a class="reference internal" href="#platform-multiple-use">Platform (multiple use)</a></li> <li><a class="reference internal" href="#supported-platform-multiple-use">Supported-Platform (multiple use)</a></li> <li><a class="reference internal" href="#summary">Summary</a></li> <li><a class="reference internal" href="#description-optional">Description (optional)</a></li> <li><a class="reference internal" href="#keywords-optional">Keywords (optional)</a></li> <li><a class="reference internal" href="#home-page-optional">Home-page (optional)</a></li> <li><a class="reference internal" href="#download-url">Download-URL</a></li> <li><a class="reference internal" href="#author-optional">Author (optional)</a></li> <li><a class="reference internal" href="#author-email-optional">Author-email (optional)</a></li> <li><a class="reference internal" href="#maintainer-optional">Maintainer (optional)</a></li> <li><a class="reference internal" href="#maintainer-email-optional">Maintainer-email (optional)</a></li> <li><a class="reference internal" href="#license-optional">License (optional)</a></li> <li><a class="reference internal" href="#classifier-multiple-use">Classifier (multiple use)</a></li> <li><a class="reference internal" href="#requires-dist-multiple-use">Requires-Dist (multiple use)</a></li> <li><a class="reference internal" href="#provides-dist-multiple-use">Provides-Dist (multiple use)</a></li> <li><a class="reference internal" href="#obsoletes-dist-multiple-use">Obsoletes-Dist (multiple use)</a></li> <li><a class="reference internal" href="#requires-python">Requires-Python</a></li> <li><a class="reference internal" href="#requires-external-multiple-use">Requires-External (multiple use)</a></li> <li><a class="reference internal" href="#project-url-multiple-use">Project-URL (multiple-use)</a></li> </ul> </li> <li><a class="reference internal" href="#version-specifiers">Version Specifiers</a></li> <li><a class="reference internal" href="#environment-markers">Environment markers</a></li> <li><a class="reference internal" href="#summary-of-differences-from-pep-314">Summary of Differences From PEP 314</a></li> <li><a class="reference internal" href="#references">References</a></li> <li><a class="reference internal" href="#copyright">Copyright</a></li> <li><a class="reference internal" href="#acknowledgements">Acknowledgements</a></li> </ul> <br> <a id="source" href="https://github.com/python/peps/blob/main/peps/pep-0345.rst">Page Source (GitHub)</a> </nav> </section> <script src="../_static/colour_scheme.js"></script> <script src="../_static/wrap_tables.js"></script> <script src="../_static/sticky_banner.js"></script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10