mirror of https://github.com/python/peps
630 lines
48 KiB
HTML
630 lines
48 KiB
HTML
|
||
<!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 421 – Adding sys.implementation | peps.python.org</title>
|
||
<link rel="shortcut icon" href="../_static/py.png">
|
||
<link rel="canonical" href="https://peps.python.org/pep-0421/">
|
||
<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 421 – Adding sys.implementation | peps.python.org'>
|
||
<meta property="og:type" content="website">
|
||
<meta property="og:url" content="https://peps.python.org/pep-0421/">
|
||
<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="Python Enhancement Proposals (PEPs)">
|
||
<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> » </li>
|
||
<li><a href="../pep-0000/">PEP Index</a> » </li>
|
||
<li>PEP 421</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 421 – Adding sys.implementation</h1>
|
||
<dl class="rfc2822 field-list simple">
|
||
<dt class="field-odd">Author<span class="colon">:</span></dt>
|
||
<dd class="field-odd">Eric Snow <ericsnowcurrently at gmail.com></dd>
|
||
<dt class="field-even">BDFL-Delegate<span class="colon">:</span></dt>
|
||
<dd class="field-even">Barry Warsaw</dd>
|
||
<dt class="field-odd">Status<span class="colon">:</span></dt>
|
||
<dd class="field-odd"><abbr title="Accepted and implementation complete, or no longer active">Final</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">Created<span class="colon">:</span></dt>
|
||
<dd class="field-odd">26-Apr-2012</dd>
|
||
<dt class="field-even">Python-Version<span class="colon">:</span></dt>
|
||
<dd class="field-even">3.3</dd>
|
||
<dt class="field-odd">Post-History<span class="colon">:</span></dt>
|
||
<dd class="field-odd">26-Apr-2012</dd>
|
||
<dt class="field-even">Resolution<span class="colon">:</span></dt>
|
||
<dd class="field-even"><a class="reference external" href="https://mail.python.org/pipermail/python-dev/2012-May/119683.html">Python-Dev message</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="#motivation">Motivation</a></li>
|
||
<li><a class="reference internal" href="#proposal">Proposal</a><ul>
|
||
<li><a class="reference internal" href="#required-attributes">Required Attributes</a></li>
|
||
<li><a class="reference internal" href="#adding-new-required-attributes">Adding New Required Attributes</a></li>
|
||
<li><a class="reference internal" href="#version-format">Version Format</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#rationale">Rationale</a><ul>
|
||
<li><a class="reference internal" href="#type-considerations">Type Considerations</a></li>
|
||
<li><a class="reference internal" href="#non-required-attributes">Non-Required Attributes</a></li>
|
||
<li><a class="reference internal" href="#why-a-part-of-sys">Why a Part of <code class="docutils literal notranslate"><span class="pre">sys</span></code>?</a></li>
|
||
<li><a class="reference internal" href="#why-strict-constraints-on-any-of-the-values">Why Strict Constraints on Any of the Values?</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#discussion">Discussion</a></li>
|
||
<li><a class="reference internal" href="#use-cases">Use-cases</a><ul>
|
||
<li><a class="reference internal" href="#platform-python-implementation">platform.python_implementation()</a></li>
|
||
<li><a class="reference internal" href="#cache-tag-generation-in-frozen-importlib">Cache Tag Generation in Frozen Importlib</a></li>
|
||
<li><a class="reference internal" href="#implementation-specific-tests">Implementation-Specific Tests</a></li>
|
||
<li><a class="reference internal" href="#jython-s-os-name-hack">Jython’s <code class="docutils literal notranslate"><span class="pre">os.name</span></code> Hack</a></li>
|
||
<li><a class="reference internal" href="#the-problem-with-sys-version-version-info-hexversion">The Problem With <code class="docutils literal notranslate"><span class="pre">sys.(version|version_info|hexversion)</span></code></a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#feedback-from-other-python-implementers">Feedback From Other Python Implementers</a><ul>
|
||
<li><a class="reference internal" href="#ironpython">IronPython</a></li>
|
||
<li><a class="reference internal" href="#jython">Jython</a></li>
|
||
<li><a class="reference internal" href="#pypy">PyPy</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#past-efforts">Past Efforts</a><ul>
|
||
<li><a class="reference internal" href="#pep-3139">PEP 3139</a></li>
|
||
<li><a class="reference internal" href="#pep-399">PEP 399</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#the-bigger-picture">The Bigger Picture</a></li>
|
||
<li><a class="reference internal" href="#alternatives">Alternatives</a></li>
|
||
<li><a class="reference internal" href="#examples-of-other-attributes">Examples of Other Attributes</a></li>
|
||
<li><a class="reference internal" href="#open-issues">Open Issues</a></li>
|
||
<li><a class="reference internal" href="#implementation">Implementation</a></li>
|
||
<li><a class="reference internal" href="#references">References</a></li>
|
||
<li><a class="reference internal" href="#copyright">Copyright</a></li>
|
||
</ul>
|
||
</details></section>
|
||
<section id="abstract">
|
||
<h2><a class="toc-backref" href="#abstract" role="doc-backlink">Abstract</a></h2>
|
||
<p>This PEP introduces a new attribute for the <code class="docutils literal notranslate"><span class="pre">sys</span></code> module:
|
||
<code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code>. The attribute holds consolidated information
|
||
about the implementation of the running interpreter. Thus
|
||
<code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code> is the source to which the standard library may
|
||
look for implementation-specific information.</p>
|
||
<p>The proposal in this PEP is in line with a broader emphasis on making
|
||
Python friendlier to alternate implementations. It describes the new
|
||
variable and the constraints on what that variable contains. The PEP
|
||
also explains some immediate use cases for <code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code>.</p>
|
||
</section>
|
||
<section id="motivation">
|
||
<h2><a class="toc-backref" href="#motivation" role="doc-backlink">Motivation</a></h2>
|
||
<p>For a number of years now, the distinction between Python-the-language
|
||
and CPython (the reference implementation) has been growing. Most of
|
||
this change is due to the emergence of Jython, IronPython, and PyPy as
|
||
viable alternate implementations of Python.</p>
|
||
<p>Consider, however, the nearly two decades of CPython-centric Python
|
||
(i.e. most of its existence). That focus has understandably
|
||
contributed to quite a few CPython-specific artifacts both in the
|
||
standard library and exposed in the interpreter. Though the core
|
||
developers have made an effort in recent years to address this, quite
|
||
a few of the artifacts remain.</p>
|
||
<p>Part of the solution is presented in this PEP: a single namespace in
|
||
which to consolidate implementation specifics. This will help focus
|
||
efforts to differentiate the implementation specifics from the
|
||
language. Additionally, it will foster a multiple-implementation
|
||
mindset.</p>
|
||
</section>
|
||
<section id="proposal">
|
||
<h2><a class="toc-backref" href="#proposal" role="doc-backlink">Proposal</a></h2>
|
||
<p>We will add a new attribute to the <code class="docutils literal notranslate"><span class="pre">sys</span></code> module, called
|
||
<code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code>, as an object with attribute-access (as opposed
|
||
to a mapping). It will contain implementation-specific information.</p>
|
||
<p>The attributes of this object will remain fixed during interpreter
|
||
execution and through the course of an implementation version. This
|
||
ensures behaviors don’t change between versions which depend on
|
||
attributes of <code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code>.</p>
|
||
<p>The object has each of the attributes described in the <a class="reference internal" href="#required-attributes">Required
|
||
Attributes</a> section below. Those attribute names will never start
|
||
with an underscore. The standard library and the language definition
|
||
will rely only on those required attributes.</p>
|
||
<p>This proposal takes a conservative approach in requiring only a small
|
||
number of attributes. As more become appropriate, they may be added
|
||
with discretion, as described in <a class="reference internal" href="#adding-new-required-attributes">Adding New Required Attributes</a>.</p>
|
||
<p>While this PEP places no other constraints on <code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code>,
|
||
it also recommends that no one rely on capabilities outside those
|
||
described here. The only exception to that recommendation is for
|
||
attributes starting with an underscore. Implementers may use those
|
||
as appropriate to store per-implementation data.</p>
|
||
<section id="required-attributes">
|
||
<h3><a class="toc-backref" href="#required-attributes" role="doc-backlink">Required Attributes</a></h3>
|
||
<p>These are attributes in <code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code> on which the standard
|
||
library and language definition will rely, meaning implementers must
|
||
define them:</p>
|
||
<dl class="simple">
|
||
<dt><strong>name</strong></dt><dd>A lower-case identifier representing the implementation. Examples
|
||
include ‘pypy’, ‘jython’, ‘ironpython’, and ‘cpython’.</dd>
|
||
<dt><strong>version</strong></dt><dd>The version of the implementation, as opposed to the version of the
|
||
language it implements. This value conforms to the format described
|
||
in <a class="reference internal" href="#version-format">Version Format</a>.</dd>
|
||
<dt><strong>hexversion</strong></dt><dd>The version of the implementation in the same hexadecimal format as
|
||
<code class="docutils literal notranslate"><span class="pre">sys.hexversion</span></code>.</dd>
|
||
<dt><strong>cache_tag</strong></dt><dd>A string used for the <a class="pep reference internal" href="../pep-3147/" title="PEP 3147 – PYC Repository Directories">PEP 3147</a> cache tag. It would
|
||
normally be a composite of the name and version (e.g. ‘cpython-33’
|
||
for CPython 3.3). However, an implementation may explicitly use a
|
||
different cache tag. If <code class="docutils literal notranslate"><span class="pre">cache_tag</span></code> is set to None, it indicates
|
||
that module caching should be disabled.</dd>
|
||
</dl>
|
||
</section>
|
||
<section id="adding-new-required-attributes">
|
||
<h3><a class="toc-backref" href="#adding-new-required-attributes" role="doc-backlink">Adding New Required Attributes</a></h3>
|
||
<p>In time more required attributes will be added to
|
||
<code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code>. However, each must have a meaningful use case
|
||
across all Python implementations in order to be considered. This is
|
||
made most clear by a use case in the standard library or language
|
||
specification.</p>
|
||
<p>All proposals for new required attributes will go through the normal
|
||
PEP process. Such a PEP need not be long, just long enough. It will
|
||
need to sufficiently spell out the rationale for the new attribute,
|
||
its use cases, and the impact it will have on the various Python
|
||
implementations.</p>
|
||
</section>
|
||
<section id="version-format">
|
||
<h3><a class="toc-backref" href="#version-format" role="doc-backlink">Version Format</a></h3>
|
||
<p>A main point of <code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code> is to contain information that
|
||
will be used internally in the standard library. In order to
|
||
facilitate the usefulness of the version attribute, its value should
|
||
be in a consistent format across implementations.</p>
|
||
<p>As such, the format of <code class="docutils literal notranslate"><span class="pre">sys.implementation.version</span></code> will follow that
|
||
of <code class="docutils literal notranslate"><span class="pre">sys.version_info</span></code>, which is effectively a named tuple. It is a
|
||
familiar format and generally consistent with normal version format
|
||
conventions.</p>
|
||
</section>
|
||
</section>
|
||
<section id="rationale">
|
||
<h2><a class="toc-backref" href="#rationale" role="doc-backlink">Rationale</a></h2>
|
||
<p>The status quo for implementation-specific information gives us that
|
||
information in a more fragile, harder to maintain way. It is spread
|
||
out over different modules or inferred from other information, as we
|
||
see with <a class="reference internal" href="#platform-python-implementation">platform.python_implementation()</a>.</p>
|
||
<p>This PEP is the main alternative to that approach. It consolidates
|
||
the implementation-specific information into a single namespace and
|
||
makes explicit that which was implicit.</p>
|
||
<section id="type-considerations">
|
||
<h3><a class="toc-backref" href="#type-considerations" role="doc-backlink">Type Considerations</a></h3>
|
||
<p>It’s very easy to get bogged down in discussions about the type of
|
||
<code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code>. However, its purpose is to support the
|
||
standard library and language definition. As such, there isn’t much
|
||
that really matters regarding its type, as opposed to a feature that
|
||
would be more generally used. Thus characteristics like immutability
|
||
and sequence-ness have been disregarded.</p>
|
||
<p>The only real choice has been between an object with attribute access
|
||
and a mapping with item access. This PEP espouses dotted access to
|
||
reflect the relatively fixed nature of the namespace.</p>
|
||
</section>
|
||
<section id="non-required-attributes">
|
||
<h3><a class="toc-backref" href="#non-required-attributes" role="doc-backlink">Non-Required Attributes</a></h3>
|
||
<p>Earlier versions of this PEP included a required attribute called
|
||
<code class="docutils literal notranslate"><span class="pre">metadata</span></code> that held any non-required, per-implementation data
|
||
<a class="footnote-reference brackets" href="#alyssa" id="id1">[16]</a>. However, this proved to be an unnecessary addition
|
||
considering the purpose of <code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code>.</p>
|
||
<p>Ultimately, non-required attributes are virtually ignored in this PEP.
|
||
They have no impact other than that careless use may collide with
|
||
future required attributes. That, however, is but a marginal concern
|
||
for <code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code>.</p>
|
||
</section>
|
||
<section id="why-a-part-of-sys">
|
||
<h3><a class="toc-backref" href="#why-a-part-of-sys" role="doc-backlink">Why a Part of <code class="docutils literal notranslate"><span class="pre">sys</span></code>?</a></h3>
|
||
<p>The <code class="docutils literal notranslate"><span class="pre">sys</span></code> module holds the new namespace because <code class="docutils literal notranslate"><span class="pre">sys</span></code> is the depot
|
||
for interpreter-centric variables and functions. Many
|
||
implementation-specific attributes are already found in <code class="docutils literal notranslate"><span class="pre">sys</span></code>.</p>
|
||
</section>
|
||
<section id="why-strict-constraints-on-any-of-the-values">
|
||
<h3><a class="toc-backref" href="#why-strict-constraints-on-any-of-the-values" role="doc-backlink">Why Strict Constraints on Any of the Values?</a></h3>
|
||
<p>As already noted in <a class="reference internal" href="#version-format">Version Format</a>, values in
|
||
<code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code> are intended for use by the standard library.
|
||
Constraining those values, essentially specifying an API for them,
|
||
allows them to be used consistently, regardless of how they are
|
||
otherwise implemented. However, care should be taken to not
|
||
over-specify the constraints.</p>
|
||
</section>
|
||
</section>
|
||
<section id="discussion">
|
||
<h2><a class="toc-backref" href="#discussion" role="doc-backlink">Discussion</a></h2>
|
||
<p>The topic of <code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code> came up on the python-ideas list
|
||
in 2009, where the reception was broadly positive <a class="footnote-reference brackets" href="#original" id="id2">[1]</a>. I
|
||
revived the discussion recently while working on a pure-python
|
||
<code class="docutils literal notranslate"><span class="pre">imp.get_tag()</span></code> <a class="footnote-reference brackets" href="#revived" id="id3">[2]</a>. Discussion has been ongoing
|
||
<a class="footnote-reference brackets" href="#feedback" id="id4">[3]</a>. The messages in <a class="reference external" href="http://bugs.python.org/issue14673">issue #14673</a> are also relevant.</p>
|
||
<p>A good part of the recent discussion centered on the type to use for
|
||
<code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code>.</p>
|
||
</section>
|
||
<section id="use-cases">
|
||
<h2><a class="toc-backref" href="#use-cases" role="doc-backlink">Use-cases</a></h2>
|
||
<section id="platform-python-implementation">
|
||
<h3><a class="toc-backref" href="#platform-python-implementation" role="doc-backlink">platform.python_implementation()</a></h3>
|
||
<p>“explicit is better than implicit”</p>
|
||
<p>The <code class="docutils literal notranslate"><span class="pre">platform</span></code> module determines the python implementation by looking
|
||
for clues in a couple different <code class="docutils literal notranslate"><span class="pre">sys</span></code> variables <a class="footnote-reference brackets" href="#guess" id="id5">[11]</a>. However,
|
||
this approach is fragile, requiring changes to the standard library
|
||
each time an implementation changes. Beyond that, support in
|
||
<code class="docutils literal notranslate"><span class="pre">platform</span></code> is limited to those implementations that core developers
|
||
have blessed by special-casing them in the <code class="docutils literal notranslate"><span class="pre">platform</span></code> module.</p>
|
||
<p>With <code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code> the various implementations would
|
||
<em>explicitly</em> set the values in their own version of the <code class="docutils literal notranslate"><span class="pre">sys</span></code>
|
||
module.</p>
|
||
<p>Another concern is that the <code class="docutils literal notranslate"><span class="pre">platform</span></code> module is part of the stdlib,
|
||
which ideally should minimize implementation details such as would be
|
||
moved to <code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code>.</p>
|
||
<p>Any overlap between <code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code> and the <code class="docutils literal notranslate"><span class="pre">platform</span></code> module
|
||
would simply defer to <code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code> (with the same interface
|
||
in <code class="docutils literal notranslate"><span class="pre">platform</span></code> wrapping it).</p>
|
||
</section>
|
||
<section id="cache-tag-generation-in-frozen-importlib">
|
||
<h3><a class="toc-backref" href="#cache-tag-generation-in-frozen-importlib" role="doc-backlink">Cache Tag Generation in Frozen Importlib</a></h3>
|
||
<p><a class="pep reference internal" href="../pep-3147/" title="PEP 3147 – PYC Repository Directories">PEP 3147</a> defined the use of a module cache and cache tags for file
|
||
names. The importlib bootstrap code, frozen into the Python binary as
|
||
of 3.3, uses the cache tags during the import process. Part of the
|
||
project to bootstrap importlib has been to clean code out of
|
||
<a class="reference external" href="http://hg.python.org/cpython/file/2f563908ebc5/Python/import.c">Python/import.c</a> that did not need to be there any longer.</p>
|
||
<p>The cache tag defined in <code class="docutils literal notranslate"><span class="pre">Python/import.c</span></code> was
|
||
<a class="pep reference internal" href="../pep-3147/#proposal" title="PEP 3147 – PYC Repository Directories § Proposal">hard-coded</a>
|
||
to <code class="docutils literal notranslate"><span class="pre">"cpython"</span> <span class="pre">MAJOR</span> <span class="pre">MINOR</span></code>. For importlib the options are
|
||
either hard-coding it in the same way, or guessing the implementation
|
||
in the same way as does <code class="docutils literal notranslate"><span class="pre">platform.python_implementation()</span></code>.</p>
|
||
<p>As long as the hard-coded tag is limited to CPython-specific code, it
|
||
is livable. However, inasmuch as other Python implementations use the
|
||
importlib code to work with the module cache, a hard-coded tag would
|
||
become a problem.</p>
|
||
<p>Directly using the <code class="docutils literal notranslate"><span class="pre">platform</span></code> module in this case is a non-starter.
|
||
Any module used in the importlib bootstrap must be built-in or frozen,
|
||
neither of which apply to the <code class="docutils literal notranslate"><span class="pre">platform</span></code> module. This is the point
|
||
that led to the recent interest in <code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code>.</p>
|
||
<p>Regardless of the outcome for the implementation name used, another
|
||
problem relates to the version used in the cache tag. That version is
|
||
likely to be the implementation version rather than the language
|
||
version. However, the implementation version is not readily
|
||
identified anywhere in the standard library.</p>
|
||
</section>
|
||
<section id="implementation-specific-tests">
|
||
<h3><a class="toc-backref" href="#implementation-specific-tests" role="doc-backlink">Implementation-Specific Tests</a></h3>
|
||
<p>Currently there are a number of implementation-specific tests in the
|
||
test suite under <code class="docutils literal notranslate"><span class="pre">Lib/test</span></code>. The test support module
|
||
(<a class="reference external" href="http://hg.python.org/cpython/file/2f563908ebc5/Lib/test/support.py">Lib/test/support.py</a>) provides some functionality for dealing with
|
||
these tests. However, like the <code class="docutils literal notranslate"><span class="pre">platform</span></code> module, <code class="docutils literal notranslate"><span class="pre">test.support</span></code>
|
||
must do some guessing that <code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code> would render
|
||
unnecessary.</p>
|
||
</section>
|
||
<section id="jython-s-os-name-hack">
|
||
<h3><a class="toc-backref" href="#jython-s-os-name-hack" role="doc-backlink">Jython’s <code class="docutils literal notranslate"><span class="pre">os.name</span></code> Hack</a></h3>
|
||
<p>In Jython, <code class="docutils literal notranslate"><span class="pre">os.name</span></code> is set to ‘java’ to accommodate special
|
||
treatment of the java environment in the standard library <a class="footnote-reference brackets" href="#os-name" id="id6">[14]</a>
|
||
<a class="footnote-reference brackets" href="#javatest" id="id7">[15]</a>. Unfortunately it masks the os name that would otherwise
|
||
go there. <code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code> would help obviate the need for this
|
||
special case. Currently Jython sets <code class="docutils literal notranslate"><span class="pre">os._name</span></code> for the normal
|
||
<code class="docutils literal notranslate"><span class="pre">os.name</span></code> value.</p>
|
||
</section>
|
||
<section id="the-problem-with-sys-version-version-info-hexversion">
|
||
<h3><a class="toc-backref" href="#the-problem-with-sys-version-version-info-hexversion" role="doc-backlink">The Problem With <code class="docutils literal notranslate"><span class="pre">sys.(version|version_info|hexversion)</span></code></a></h3>
|
||
<p>Earlier versions of this PEP made the mistake of calling
|
||
<code class="docutils literal notranslate"><span class="pre">sys.version_info</span></code> (and friends) the version of the Python language,
|
||
in contrast to the implementation. However, this is not the case.
|
||
Instead, it is the version of the CPython implementation. Incidentally,
|
||
the first two components of <code class="docutils literal notranslate"><span class="pre">sys.version_info</span></code> (major and minor) also
|
||
reflect the version of the language definition.</p>
|
||
<p>As Barry Warsaw noted, the “semantics of sys.version_info have been
|
||
sufficiently squishy in the past” <a class="footnote-reference brackets" href="#barry" id="id8">[17]</a>. With
|
||
<code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code> we have the opportunity to improve this
|
||
situation by first establishing an explicit location for the version of
|
||
the implementation.</p>
|
||
<p>This PEP makes no other effort to directly clarify the semantics of
|
||
<code class="docutils literal notranslate"><span class="pre">sys.version_info</span></code>. Regardless, having an explicit version for the
|
||
implementation will definitely help to clarify the distinction from the
|
||
language version.</p>
|
||
</section>
|
||
</section>
|
||
<section id="feedback-from-other-python-implementers">
|
||
<h2><a class="toc-backref" href="#feedback-from-other-python-implementers" role="doc-backlink">Feedback From Other Python Implementers</a></h2>
|
||
<section id="ironpython">
|
||
<h3><a class="toc-backref" href="#ironpython" role="doc-backlink">IronPython</a></h3>
|
||
<p>Jeff Hardy responded to a request for feedback <a class="footnote-reference brackets" href="#id14" id="id9">[4]</a>. He
|
||
said, “I’ll probably add it the day after it’s approved”
|
||
<a class="footnote-reference brackets" href="#jeff-hardy-2012" id="id10">[6]</a>. He also gave useful feedback on both the type of
|
||
<code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code> and on the <code class="docutils literal notranslate"><span class="pre">metadata</span></code> attribute (which has
|
||
since been removed from the PEP).</p>
|
||
</section>
|
||
<section id="jython">
|
||
<h3><a class="toc-backref" href="#jython" role="doc-backlink">Jython</a></h3>
|
||
<p>In 2009 Frank Wierzbicki said this (relative to Jython implementing the
|
||
required attributes) <a class="footnote-reference brackets" href="#frank-wierzbicki-2009" id="id11">[8]</a>:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Speaking</span> <span class="k">for</span> <span class="n">Jython</span><span class="p">,</span> <span class="n">so</span> <span class="n">far</span> <span class="n">it</span> <span class="n">looks</span> <span class="n">like</span> <span class="n">something</span> <span class="n">we</span> <span class="n">would</span> <span class="n">adopt</span>
|
||
<span class="n">soonish</span> <span class="n">after</span> <span class="n">it</span> <span class="n">was</span> <span class="n">accepted</span> <span class="p">(</span><span class="n">it</span> <span class="n">looks</span> <span class="n">pretty</span> <span class="n">useful</span> <span class="n">to</span> <span class="n">me</span><span class="p">)</span><span class="o">.</span>
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
<section id="pypy">
|
||
<h3><a class="toc-backref" href="#pypy" role="doc-backlink">PyPy</a></h3>
|
||
<p>Some of the PyPy developers have responded to a request for feedback
|
||
<a class="footnote-reference brackets" href="#id16" id="id12">[9]</a>. Armin Rigo said the following <a class="footnote-reference brackets" href="#armin-rigo-2012" id="id13">[10]</a>:</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">For</span> <span class="n">myself</span><span class="p">,</span> <span class="n">I</span> <span class="n">can</span> <span class="n">only</span> <span class="n">say</span> <span class="n">that</span> <span class="n">it</span> <span class="n">looks</span> <span class="n">like</span> <span class="n">a</span> <span class="n">good</span> <span class="n">idea</span><span class="p">,</span> <span class="n">which</span> <span class="n">we</span>
|
||
<span class="n">will</span> <span class="n">happily</span> <span class="n">adhere</span> <span class="n">to</span> <span class="n">when</span> <span class="n">we</span> <span class="n">migrate</span> <span class="n">to</span> <span class="n">Python</span> <span class="mf">3.3</span><span class="o">.</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>He also expressed support for keeping the required list small. Both
|
||
Armin and Laura Creighton indicated that an effort to better catalog
|
||
Python’s implementation would be welcome. Such an effort, for which
|
||
this PEP is a small start, will be considered separately.</p>
|
||
</section>
|
||
</section>
|
||
<section id="past-efforts">
|
||
<h2><a class="toc-backref" href="#past-efforts" role="doc-backlink">Past Efforts</a></h2>
|
||
<section id="pep-3139">
|
||
<h3><a class="toc-backref" href="#pep-3139" role="doc-backlink">PEP 3139</a></h3>
|
||
<p><a class="pep reference internal" href="../pep-3139/" title="PEP 3139 – Cleaning out sys and the “interpreter” module">PEP 3139</a>, from 2008, recommended a clean-up of the <code class="docutils literal notranslate"><span class="pre">sys</span></code> module in
|
||
part by extracting implementation-specific variables and functions
|
||
into a separate module. <a class="pep reference internal" href="../pep-0421/" title="PEP 421 – Adding sys.implementation">PEP 421</a> is less ambitious version of that
|
||
idea. While <a class="pep reference internal" href="../pep-3139/" title="PEP 3139 – Cleaning out sys and the “interpreter” module">PEP 3139</a> was rejected, its goals are reflected in <a class="pep reference internal" href="../pep-0421/" title="PEP 421 – Adding sys.implementation">PEP 421</a>
|
||
to a large extent, though with a much lighter approach.</p>
|
||
</section>
|
||
<section id="pep-399">
|
||
<h3><a class="toc-backref" href="#pep-399" role="doc-backlink">PEP 399</a></h3>
|
||
<p><a class="pep reference internal" href="../pep-0399/" title="PEP 399 – Pure Python/C Accelerator Module Compatibility Requirements">PEP 399</a> dictates policy regarding the standard library, helping to make
|
||
it friendlier to alternate implementations. <a class="pep reference internal" href="../pep-0421/" title="PEP 421 – Adding sys.implementation">PEP 421</a> is proposed in
|
||
that same spirit.</p>
|
||
</section>
|
||
</section>
|
||
<section id="the-bigger-picture">
|
||
<h2><a class="toc-backref" href="#the-bigger-picture" role="doc-backlink">The Bigger Picture</a></h2>
|
||
<p>It’s worth noting again that this PEP is a small part of a larger
|
||
ongoing effort to identify the implementation-specific parts of Python
|
||
and mitigate their impact on alternate implementations.</p>
|
||
<p><code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code> is a focal point for implementation-specific
|
||
data, acting as a nexus for cooperation between the language, the
|
||
standard library, and the different implementations. As time goes by
|
||
it is feasible that <code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code> will assume current
|
||
attributes of <code class="docutils literal notranslate"><span class="pre">sys</span></code> and other builtin/stdlib modules, where
|
||
appropriate. In this way, it is a <a class="pep reference internal" href="../pep-3137/" title="PEP 3137 – Immutable Bytes and Mutable Buffer">PEP 3137</a>-lite, but starting as
|
||
small as possible.</p>
|
||
<p>However, as already noted, many other efforts predate
|
||
<code class="docutils literal notranslate"><span class="pre">sys.implementation</span></code>. Neither is it necessarily a major part of the
|
||
effort. Rather, consider it as part of the infrastructure of the
|
||
effort to make Python friendlier to alternate implementations.</p>
|
||
</section>
|
||
<section id="alternatives">
|
||
<h2><a class="toc-backref" href="#alternatives" role="doc-backlink">Alternatives</a></h2>
|
||
<p>Since the single-namespace-under-sys approach is relatively
|
||
straightforward, no alternatives have been considered for this PEP.</p>
|
||
</section>
|
||
<section id="examples-of-other-attributes">
|
||
<h2><a class="toc-backref" href="#examples-of-other-attributes" role="doc-backlink">Examples of Other Attributes</a></h2>
|
||
<p>These are examples only and not part of the proposal. Most of them
|
||
were suggested during previous discussions, but did not fit into the
|
||
goals of this PEP. (See <a class="reference internal" href="#adding-new-required-attributes">Adding New Required Attributes</a> if they get
|
||
you excited.)</p>
|
||
<dl class="simple">
|
||
<dt><strong>common_name</strong></dt><dd>The case-sensitive name by which the implementation is known.</dd>
|
||
<dt><strong>vcs_url</strong></dt><dd>A URL for the main VCS repository for the implementation project.</dd>
|
||
<dt><strong>vcs_revision_id</strong></dt><dd>A value that identifies the VCS revision of the implementation.</dd>
|
||
<dt><strong>build_toolchain</strong></dt><dd>The tools used to build the interpreter.</dd>
|
||
<dt><strong>build_date</strong></dt><dd>The timestamp of when the interpreter was built.</dd>
|
||
<dt><strong>homepage</strong></dt><dd>The URL of the implementation’s website.</dd>
|
||
<dt><strong>site_prefix</strong></dt><dd>The preferred site prefix for the implementation.</dd>
|
||
<dt><strong>runtime</strong></dt><dd>The run-time environment in which the interpreter is running, as
|
||
in “Common Language <em>Runtime</em>” (.NET CLR) or “Java <em>Runtime</em>
|
||
Executable”.</dd>
|
||
<dt><strong>gc_type</strong></dt><dd>The type of garbage collection used, like “reference counting” or
|
||
“mark and sweep”.</dd>
|
||
</dl>
|
||
</section>
|
||
<section id="open-issues">
|
||
<h2><a class="toc-backref" href="#open-issues" role="doc-backlink">Open Issues</a></h2>
|
||
<p>Currently none.</p>
|
||
</section>
|
||
<section id="implementation">
|
||
<h2><a class="toc-backref" href="#implementation" role="doc-backlink">Implementation</a></h2>
|
||
<p>The implementation of this PEP is covered in <a class="reference external" href="http://bugs.python.org/issue14673">issue #14673</a>.</p>
|
||
</section>
|
||
<section id="references">
|
||
<h2><a class="toc-backref" href="#references" role="doc-backlink">References</a></h2>
|
||
<aside class="footnote-list brackets">
|
||
<aside class="footnote brackets" id="original" role="doc-footnote">
|
||
<dt class="label" id="original">[<a href="#id2">1</a>]</dt>
|
||
<dd>The 2009 sys.implementation discussion:
|
||
<a class="reference external" href="https://mail.python.org/pipermail/python-dev/2009-October/092893.html">https://mail.python.org/pipermail/python-dev/2009-October/092893.html</a></aside>
|
||
<aside class="footnote brackets" id="revived" role="doc-footnote">
|
||
<dt class="label" id="revived">[<a href="#id3">2</a>]</dt>
|
||
<dd>The initial 2012 discussion:
|
||
<a class="reference external" href="https://mail.python.org/pipermail/python-ideas/2012-March/014555.html">https://mail.python.org/pipermail/python-ideas/2012-March/014555.html</a>
|
||
(and <a class="reference external" href="https://mail.python.org/pipermail/python-ideas/2012-April/014878.html">https://mail.python.org/pipermail/python-ideas/2012-April/014878.html</a>)</aside>
|
||
<aside class="footnote brackets" id="feedback" role="doc-footnote">
|
||
<dt class="label" id="feedback">[<a href="#id4">3</a>]</dt>
|
||
<dd>Feedback on the PEP:
|
||
<a class="reference external" href="https://mail.python.org/pipermail/python-ideas/2012-April/014954.html">https://mail.python.org/pipermail/python-ideas/2012-April/014954.html</a></aside>
|
||
<aside class="footnote brackets" id="id14" role="doc-footnote">
|
||
<dt class="label" id="id14">[<a href="#id9">4</a>]</dt>
|
||
<dd>Feedback from the IronPython developers:
|
||
<a class="reference external" href="https://mail.python.org/pipermail/ironpython-users/2012-May/015980.html">https://mail.python.org/pipermail/ironpython-users/2012-May/015980.html</a></aside>
|
||
<aside class="footnote brackets" id="dino-viehland-2009" role="doc-footnote">
|
||
<dt class="label" id="dino-viehland-2009">[5]</dt>
|
||
<dd>(2009) Dino Viehland offers his opinion:
|
||
<a class="reference external" href="https://mail.python.org/pipermail/python-dev/2009-October/092894.html">https://mail.python.org/pipermail/python-dev/2009-October/092894.html</a></aside>
|
||
<aside class="footnote brackets" id="jeff-hardy-2012" role="doc-footnote">
|
||
<dt class="label" id="jeff-hardy-2012">[<a href="#id10">6</a>]</dt>
|
||
<dd>(2012) Jeff Hardy offers his opinion:
|
||
<a class="reference external" href="https://mail.python.org/pipermail/ironpython-users/2012-May/015981.html">https://mail.python.org/pipermail/ironpython-users/2012-May/015981.html</a></aside>
|
||
<aside class="footnote brackets" id="id15" role="doc-footnote">
|
||
<dt class="label" id="id15">[7]</dt>
|
||
<dd>Feedback from the Jython developers:
|
||
???</aside>
|
||
<aside class="footnote brackets" id="frank-wierzbicki-2009" role="doc-footnote">
|
||
<dt class="label" id="frank-wierzbicki-2009">[<a href="#id11">8</a>]</dt>
|
||
<dd>(2009) Frank Wierzbicki offers his opinion:
|
||
<a class="reference external" href="https://mail.python.org/pipermail/python-dev/2009-October/092974.html">https://mail.python.org/pipermail/python-dev/2009-October/092974.html</a></aside>
|
||
<aside class="footnote brackets" id="id16" role="doc-footnote">
|
||
<dt class="label" id="id16">[<a href="#id12">9</a>]</dt>
|
||
<dd>Feedback from the PyPy developers:
|
||
<a class="reference external" href="https://mail.python.org/pipermail/pypy-dev/2012-May/009883.html">https://mail.python.org/pipermail/pypy-dev/2012-May/009883.html</a></aside>
|
||
<aside class="footnote brackets" id="armin-rigo-2012" role="doc-footnote">
|
||
<dt class="label" id="armin-rigo-2012">[<a href="#id13">10</a>]</dt>
|
||
<dd>(2012) Armin Rigo offers his opinion:
|
||
<a class="reference external" href="https://mail.python.org/pipermail/pypy-dev/2012-May/009884.html">https://mail.python.org/pipermail/pypy-dev/2012-May/009884.html</a></aside>
|
||
<aside class="footnote brackets" id="guess" role="doc-footnote">
|
||
<dt class="label" id="guess">[<a href="#id5">11</a>]</dt>
|
||
<dd>The <code class="docutils literal notranslate"><span class="pre">platform</span></code> code which divines the implementation name:
|
||
<a class="reference external" href="http://hg.python.org/cpython/file/2f563908ebc5/Lib/platform.py#l1247">http://hg.python.org/cpython/file/2f563908ebc5/Lib/platform.py#l1247</a></aside>
|
||
<aside class="footnote brackets" id="tag-impl" role="doc-footnote">
|
||
<dt class="label" id="tag-impl">[12]</dt>
|
||
<dd>The original implementation of the cache tag in CPython:
|
||
<a class="reference external" href="http://hg.python.org/cpython/file/2f563908ebc5/Python/import.c#l121">http://hg.python.org/cpython/file/2f563908ebc5/Python/import.c#l121</a></aside>
|
||
<aside class="footnote brackets" id="tests" role="doc-footnote">
|
||
<dt class="label" id="tests">[13]</dt>
|
||
<dd>Examples of implementation-specific handling in test.support:
|
||
* <a class="reference external" href="http://hg.python.org/cpython/file/2f563908ebc5/Lib/test/support.py#l509">http://hg.python.org/cpython/file/2f563908ebc5/Lib/test/support.py#l509</a>
|
||
* <a class="reference external" href="http://hg.python.org/cpython/file/2f563908ebc5/Lib/test/support.py#l1246">http://hg.python.org/cpython/file/2f563908ebc5/Lib/test/support.py#l1246</a>
|
||
* <a class="reference external" href="http://hg.python.org/cpython/file/2f563908ebc5/Lib/test/support.py#l1252">http://hg.python.org/cpython/file/2f563908ebc5/Lib/test/support.py#l1252</a>
|
||
* <a class="reference external" href="http://hg.python.org/cpython/file/2f563908ebc5/Lib/test/support.py#l1275">http://hg.python.org/cpython/file/2f563908ebc5/Lib/test/support.py#l1275</a></aside>
|
||
<aside class="footnote brackets" id="os-name" role="doc-footnote">
|
||
<dt class="label" id="os-name">[<a href="#id6">14</a>]</dt>
|
||
<dd>The standard library entry for os.name:
|
||
<a class="reference external" href="http://docs.python.org/3.3/library/os.html#os.name">http://docs.python.org/3.3/library/os.html#os.name</a></aside>
|
||
<aside class="footnote brackets" id="javatest" role="doc-footnote">
|
||
<dt class="label" id="javatest">[<a href="#id7">15</a>]</dt>
|
||
<dd>The use of <code class="docutils literal notranslate"><span class="pre">os.name</span></code> as ‘java’ in the stdlib test suite.
|
||
<a class="reference external" href="http://hg.python.org/cpython/file/2f563908ebc5/Lib/test/support.py#l512">http://hg.python.org/cpython/file/2f563908ebc5/Lib/test/support.py#l512</a></aside>
|
||
<aside class="footnote brackets" id="alyssa" role="doc-footnote">
|
||
<dt class="label" id="alyssa">[<a href="#id1">16</a>]</dt>
|
||
<dd>Alyssa (Nick) Coghlan’s proposal for <code class="docutils literal notranslate"><span class="pre">sys.implementation.metadata</span></code>:
|
||
<a class="reference external" href="https://mail.python.org/pipermail/python-ideas/2012-May/014984.html">https://mail.python.org/pipermail/python-ideas/2012-May/014984.html</a></aside>
|
||
<aside class="footnote brackets" id="barry" role="doc-footnote">
|
||
<dt class="label" id="barry">[<a href="#id8">17</a>]</dt>
|
||
<dd>Feedback from Barry Warsaw:
|
||
<a class="reference external" href="https://mail.python.org/pipermail/python-dev/2012-May/119374.html">https://mail.python.org/pipermail/python-dev/2012-May/119374.html</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>
|
||
<hr class="docutils" />
|
||
<p>Source: <a class="reference external" href="https://github.com/python/peps/blob/main/peps/pep-0421.rst">https://github.com/python/peps/blob/main/peps/pep-0421.rst</a></p>
|
||
<p>Last modified: <a class="reference external" href="https://github.com/python/peps/commits/main/peps/pep-0421.rst">2023-10-11 12:05:51 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="#motivation">Motivation</a></li>
|
||
<li><a class="reference internal" href="#proposal">Proposal</a><ul>
|
||
<li><a class="reference internal" href="#required-attributes">Required Attributes</a></li>
|
||
<li><a class="reference internal" href="#adding-new-required-attributes">Adding New Required Attributes</a></li>
|
||
<li><a class="reference internal" href="#version-format">Version Format</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#rationale">Rationale</a><ul>
|
||
<li><a class="reference internal" href="#type-considerations">Type Considerations</a></li>
|
||
<li><a class="reference internal" href="#non-required-attributes">Non-Required Attributes</a></li>
|
||
<li><a class="reference internal" href="#why-a-part-of-sys">Why a Part of <code class="docutils literal notranslate"><span class="pre">sys</span></code>?</a></li>
|
||
<li><a class="reference internal" href="#why-strict-constraints-on-any-of-the-values">Why Strict Constraints on Any of the Values?</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#discussion">Discussion</a></li>
|
||
<li><a class="reference internal" href="#use-cases">Use-cases</a><ul>
|
||
<li><a class="reference internal" href="#platform-python-implementation">platform.python_implementation()</a></li>
|
||
<li><a class="reference internal" href="#cache-tag-generation-in-frozen-importlib">Cache Tag Generation in Frozen Importlib</a></li>
|
||
<li><a class="reference internal" href="#implementation-specific-tests">Implementation-Specific Tests</a></li>
|
||
<li><a class="reference internal" href="#jython-s-os-name-hack">Jython’s <code class="docutils literal notranslate"><span class="pre">os.name</span></code> Hack</a></li>
|
||
<li><a class="reference internal" href="#the-problem-with-sys-version-version-info-hexversion">The Problem With <code class="docutils literal notranslate"><span class="pre">sys.(version|version_info|hexversion)</span></code></a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#feedback-from-other-python-implementers">Feedback From Other Python Implementers</a><ul>
|
||
<li><a class="reference internal" href="#ironpython">IronPython</a></li>
|
||
<li><a class="reference internal" href="#jython">Jython</a></li>
|
||
<li><a class="reference internal" href="#pypy">PyPy</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#past-efforts">Past Efforts</a><ul>
|
||
<li><a class="reference internal" href="#pep-3139">PEP 3139</a></li>
|
||
<li><a class="reference internal" href="#pep-399">PEP 399</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#the-bigger-picture">The Bigger Picture</a></li>
|
||
<li><a class="reference internal" href="#alternatives">Alternatives</a></li>
|
||
<li><a class="reference internal" href="#examples-of-other-attributes">Examples of Other Attributes</a></li>
|
||
<li><a class="reference internal" href="#open-issues">Open Issues</a></li>
|
||
<li><a class="reference internal" href="#implementation">Implementation</a></li>
|
||
<li><a class="reference internal" href="#references">References</a></li>
|
||
<li><a class="reference internal" href="#copyright">Copyright</a></li>
|
||
</ul>
|
||
|
||
<br>
|
||
<a id="source" href="https://github.com/python/peps/blob/main/peps/pep-0421.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> |