What is binary distribution in python?
The binary distribution format (wheel) was originally defined in PEP 427. The current version of the specification is here. Show
Abstract¶This PEP describes a built-package format for Python called “wheel”. A wheel is a ZIP-format archive with a specially formatted file name and the PEP Acceptance¶This PEP was accepted, and the defined wheel version updated to 1.0, by Nick Coghlan on 16th February, 2013 1 Rationale¶Python needs a package format that is easier to install than sdist. Python’s sdist packages are defined by and require the distutils and setuptools build systems, running arbitrary code to build-and-install, and re-compile, code just so it can be installed into a new virtualenv. This system of conflating build-install is slow, hard to maintain, and hinders innovation in both build systems and installers. Wheel attempts to remedy these problems by providing a simpler interface between the build system and the installer. The wheel binary package format frees installers from having to know about the build system, saves time by amortizing compile time over many installations, and removes the need to install a build system in the target environment. Details¶Installing a wheel ‘distribution-1.0-py32-none-any.whl’¶Wheel installation notionally consists of two phases:
Recommended installer features¶Rewrite#!python .In wheel, scripts are packaged in The
In wheel, scripts packaged on Unix systems will certainly not have accompanying .exe wrappers. Windows installers may want to add them during install. Recommended archiver features¶Place.dist-info at the end of the archive.Archivers are encouraged to place the File Format¶File name convention¶The wheel filename is
Distribution name, e.g. ‘django’, ‘pyramid’. versionDistribution version, e.g. 1.0. build tagOptional build number. Must start with a digit. Acts as a tie-breaker if two wheel file names are the same in all other respects (i.e. name, version, and other
tags). Sort as an empty tuple if unspecified, else sort as a two-item tuple with the first item being the initial digits as an E.g. ‘py27’, ‘py2’, ‘py3’. abi tagE.g. ‘cp33m’, ‘abi3’, ‘none’. platform tagE.g. ‘linux_x86_64’, ‘any’. For example, The last three components of the filename before the extension are called “compatibility tags.” The compatibility tags express the package’s basic interpreter requirements and are detailed in PEP 425. Escaping and Unicode¶As the components of the filename are separated by a dash (
Tools producing wheels should verify that the filename components do not contain The archive filename is Unicode. It will be some time before the tools are updated to support non-ASCII filenames, but they are supported in this specification. The filenames inside the archive are encoded as UTF-8. Although some ZIP clients in common use do not properly display UTF-8 filenames, the encoding is supported by both the ZIP specification and Python’s File contents¶The contents of a wheel file, where {distribution} is replaced with the name of the package, e.g.
This version of the wheel specification is based on the distutils install schemes and does not define how to install files to other locations. The layout offers a superset of the functionality provided by the existing wininst and egg binary formats. The .dist-info directory¶
The .data directory¶Any file that is not normally installed inside site-packages goes into the .data directory, named as the .dist-info directory but with the .data/ extension: distribution-1.0.dist-info/ distribution-1.0.data/ The .data directory contains subdirectories with the scripts, headers, documentation and so forth from the distribution. During installation the contents of these subdirectories are moved onto their destination paths. Signed wheel files¶Wheel files include an extended RECORD that enables digital signatures. PEP
376’s RECORD is altered to include a secure hash file.py,sha256=AVTFPZpEKzuHr7OvQZmhaU3LvwKz06AJw8mT\_pNh2yI,3144 distribution-1.0.dist-info/RECORD,, The signature file(s) RECORD.jws and RECORD.p7s are not mentioned in RECORD at all since they can only be added after RECORD is generated. Every other file in the archive must have a correct hash in RECORD or the installation will fail. If JSON web signatures are used, one or more JSON Web Signature JSON Serialization (JWS-JS) signatures is stored in a file RECORD.jws adjacent to RECORD. JWS is used to sign RECORD by including the SHA-256 hash of RECORD as the signature’s JSON payload: { "hash": "sha256=ADD-r2urObZHcxBW3Cr-vDCu5RJwT4CaRTHiFmbcIYY" } (The hash value is the same format used in RECORD.) If RECORD.p7s is used, it must contain a detached S/MIME format signature of RECORD. A wheel installer is not required to understand digital signatures but MUST verify the hashes in RECORD against the extracted file contents. When the installer checks file hashes against RECORD, a separate signature checker only needs to establish that RECORD matches the signature. See
Comparison to .egg¶
FAQ¶Wheel defines a .data directory. Should I put all my data there?¶
Why does wheel include attached signatures?¶
Why does wheel allow JWS signatures?¶
Why does wheel also allow S/MIME signatures?¶
What’s the deal with “purelib” vs. “platlib”?¶
Is it possible to import Python code directly from a wheel file?¶
Changes¶Since PEP 427, this specification has changed as follows:
References¶1PEP acceptance (https://mail.python.org/pipermail/python-dev/2013-February/124103.html) Appendix¶Example urlsafe-base64-nopad implementation: # urlsafe-base64-nopad for Python 3 import base64 def urlsafe_b64encode_nopad(data): return base64.urlsafe_b64encode(data).rstrip(b'=') def urlsafe_b64decode_nopad(data): pad = b'=' * (4 - (len(data) & 3)) return base64.urlsafe_b64decode(data + pad) Copyright¶This document has been placed into the public domain. What is binary distribution format?A binary distribution is the binary representation of the code in a archive format of a release. Compiled Code is generally packaged in archive that you can get via a package manager. The distribution step will transfer and reference the archive in a repository.
What is binomial distribution in Python?Binomial Distribution is a Discrete Distribution. It describes the outcome of binary scenarios, e.g. toss of a coin, it will either be head or tails. It has three parameters: n - number of trials. p - probability of occurence of each trial (e.g. for toss of a coin 0.5 each).
What are binaries Python?A binary Python package is usually a packaged Python library that comes with one or more pre-compiled binary modules. Theses modules are usually . so or . dll libraries in binary (compiled) form. They are often written in C.
What is a distribution Python?A distribution of Python is a bundle that contains an implementation of Python along with a bunch of libraries or tools. In theory, a distribution of Python could use any implementation, although all the ones I know of use CPython.
|