<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Metadata Versions — pkginfo 1.1 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '', VERSION: '1.1', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <link rel="top" title="pkginfo 1.1 documentation" href="index.html" /> <link rel="next" title="Distribution Indexes" href="indexes.html" /> <link rel="prev" title="Distribution Types" href="distributions.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="indexes.html" title="Distribution Indexes" accesskey="N">next</a> |</li> <li class="right" > <a href="distributions.html" title="Distribution Types" accesskey="P">previous</a> |</li> <li><a href="index.html">pkginfo 1.1 documentation</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="metadata-versions"> <h1>Metadata Versions<a class="headerlink" href="#metadata-versions" title="Permalink to this headline">ΒΆ</a></h1> <p>The allowed <tt class="docutils literal"><span class="pre">PKG-INFO</span></tt> fields and their semantics are defined in a series of PEPs, each of which updates the metadata version field.</p> <ul class="simple"> <li>Metadata version 1.0 is specified in <a class="reference external" href="http://svn.python.org/projects/peps/trunk/pep-0241.txt">PEP 241</a>.</li> <li>Metadata version 1.1 is specified in <a class="reference external" href="http://svn.python.org/projects/peps/trunk/pep-0314.txt">PEP 314</a>.</li> <li>Metadata version 1.2 is specified in <a class="reference external" href="http://svn.python.org/projects/peps/trunk/pep-0345.txt">PEP 345</a> (still in draft).</li> </ul> <p>A given <tt class="docutils literal"><span class="pre">Distribution</span></tt> object parses / exposes the attributes which correspond to the metadata version specified in its <tt class="docutils literal"><span class="pre">PKG-INFO</span></tt>.</p> <p>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’:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">pkginfo</span> <span class="kn">import</span> <span class="n">SDist</span> <span class="gp">>>> </span><span class="n">mypackage</span> <span class="o">=</span> <span class="n">SDist</span><span class="p">(</span><span class="s">'docs/examples/mypackage-0.1.tar.gz'</span><span class="p">,</span> <span class="gp">... </span> <span class="n">metadata_version</span><span class="o">=</span><span class="s">'1.1'</span><span class="p">)</span> <span class="gp">>>> </span><span class="k">print</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">mypackage</span><span class="o">.</span><span class="n">classifiers</span><span class="p">]</span> <span class="go">['Development Status :: 4 - Beta', 'Environment :: Console (Text Based)']</span> </pre></div> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="distributions.html" title="previous chapter">Distribution Types</a></p> <h4>Next topic</h4> <p class="topless"><a href="indexes.html" title="next chapter">Distribution Indexes</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/metadata.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="indexes.html" title="Distribution Indexes" >next</a> |</li> <li class="right" > <a href="distributions.html" title="Distribution Types" >previous</a> |</li> <li><a href="index.html">pkginfo 1.1 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2009-2013, Tres Seaver. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> </body> </html>