update tags PEP

This commit is contained in:
Daniel Holth 2012-09-16 13:27:11 -04:00
parent dfb0975b38
commit ffbc22c7cb
1 changed files with 36 additions and 37 deletions

View File

@ -57,7 +57,7 @@ The tag format is {python tag}-{abi tag}-{platform tag}
python tag
py27, cp33
abi tag
cp33dmu, none
cp32dmu, none
platform tag
linux_x86_64, any
@ -82,9 +82,15 @@ codes, initially:
Other Python implementations should use `sys.implementation.name`.
The language version is `py_version_nodot`, or just the major version
`2` or `3` for many pure-Python distributions. CPython gets away with
no dot, but if one is needed the underscore `_` is used instead.
The language version is `py_version_nodot`. CPython gets away with no dot,
but if one is needed the underscore `_` is used instead.
The version can be just the major version `2` or `3` `py2`, `py3` for
many pure-Python distributions.
Importantly, major-version-only tags like `py2` and `py3` are not
shorthand for `py20` and `py30`. Instead, these tags mean the packager
intentionally released a cross-version-compatible distribution.
A single-source Python 2/3 compatible distribution can use the compound
tag `py2.py3`. See `Compressed Tag Sets`, below.
@ -97,8 +103,8 @@ extension modules. For implementation-specific ABIs, the implementation
is abbreviated in the same way as the Python Tag, e.g. `cp33d` would be
the CPython 3.3 ABI with debugging.
As a special case, the CPython stable ABI starts with `py`; `py32`
is that ABI with only the operations available from Python 3.2 onward.
The CPython stable ABI is `abi3` as in the shared library suffix, and
is available starting with Python 3.2.
Implementations with a very unstable ABI may use the first 6 bytes (as
8 base64-encoded characters) of the SHA-256 hash of ther source code
@ -112,48 +118,41 @@ Platform Tag
The platform tag is simply `distutils.util.get_platform()` with all
hyphens `-` and periods `.` replaced with underscore `_`.
* win32
* linux_i386
* linux_x86_64
Use
===
The tags are used by installers to decide which built distribution
(if any) to download from a list of potential built distributions.
Installers will have a list of (python, abi, plat) that the current
Python installation can run sorted by order of preference. Each built
distribution recieves a score based on its tag's position in the list,
and the most-preferred distribution is the one that is installed.
If no built distribution matches the list of supported tag tuples then
the installer falls back to installing from the source distribution.
Tags are only compared for equality; they are never greater or less than
another tag, and a tag that 'startswith' another tag is not a subset of
the shorter tag.
The installer maintains a list of (pyver, abi, arch) tuples that it
will support. If the built distribution's tag is `in` the list, then
it can be installed.
For example, an installer running under CPython 3.3 on an imaginary MMIX
system might prefer, in order::
For example, an installer running under CPython 3.3 on a linux_x86_64
system might support::
1. (cp33, cp33, mmix) # built for this specific version of Python
2. (cp33, py32, mmix) # using the stable ABI as defined by Python 3.2
3. (cp33, none, mmix) # using no ABI, but still depending on the specific
platform (e.g. through ctypes or os.system)
4. (cp33, none, any) # pure-Python distribution for the current Python
5. (py33, none, any) # pure-Python distribution for the current (generic)
Python
6. (py32, none, any) # pure-Python distributions for older versions of
Python
7. (py31, none, any) # ""
8. (py30, none, any) # ""
9. (py3, none, any) # ""
A distribution that requires CPython 3.3 or CPython 2.7 and has an
optional extension module could distribute built distributions tagged
`cp33-cp3-mmix`, `cp33-none-any`, and `cp27-none-any`. (Our imaginary
program is using 2to3, so the built distribution is not compatible across
major releases.) `cp33-cp3-mmix` gets a score of 1, `cp33-none-any`
gets a score of 3, and `cp27-none-any` is not in the list at all. Since
`cp33-cp3-mmix` has the best score, that built distribution is installed.
1. cp33-cp33m-linux_x86_64
2. cp33-none-linux_x86_64
3. cp3-abi3-linux_x86_64
4. cp33-none-any
5. cp3-none-any
6. py33-none-any
7. py3-none-any
A user could instruct their installer to fall back to building from an
sdist more or less often by configuring this list of tags.
Rarely there will be more than one supported built distribution for a
particular version of a package. For example, a packager could release
a package tagged `cp3-abi3-linux_x86_64` that contains an optional C
extension and the same distribution tagged `py3-none-any` that does not.
The index of the tag in the supported tags list breaks the tie, and the
package with the C extension is installed in preference to the package
without because that tag appears first in the list.
Compressed Tag Sets
===================