Python 打包:wheels vs tarball (tar.gz)
Python packaging: wheels vs tarball (tar.gz)
wheels 优于 eggs 的优势很明显(请参阅为什么不是 egg 部分?https://pypi.python.org/pypi/wheel)。
然而,我并不完全清楚使用轮子比 tar.gz
有什么优势。我可能遗漏了一些明显的东西,比如 "they are the same"。
正如我所见,两者都可以直接使用 pip
安装(甚至在 Windows 中),具有相似的大小,并且在打包时需要类似的努力。
在我看来,这就像您在证明打包方法的合理性时可能会遇到的那种问题。
编辑:
刚找到一个 tar.gz
可能比轮子更好的例子。 CherryPy (https://pypi.python.org/pypi/CherryPy) 只为 Python 3.x 提供轮子,所以如果你想有一个本地存储库来为 Python 2.7 和 3.x 依赖项提供 CherryPy,存储压缩包似乎更有意义。这个对吗? (只是为了在讨论中添加一些 "case-based" 理由)
Advantages of wheels
• Faster installation for pure python and native C extension packages.
• Avoids arbitrary code execution for installation. (Avoids setup.py)
• Installation of a C extension does not require a compiler on Windows or OS X.
• Allows better caching for testing and continuous integration.
• Creates .pyc files as part of installation to ensure they match the python interpreter used.
• More consistent installs across platforms and machines.
确保轮子已安装。
python3 -m pip install wheel
这为我解答了(直接来自 wheel PEP):
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.
https://www.python.org/dev/peps/pep-0427/#rationale
请注意,我们所说的 tarball 是上面提到的 "sdists"。
wheels 优于 eggs 的优势很明显(请参阅为什么不是 egg 部分?https://pypi.python.org/pypi/wheel)。
然而,我并不完全清楚使用轮子比 tar.gz
有什么优势。我可能遗漏了一些明显的东西,比如 "they are the same"。
正如我所见,两者都可以直接使用 pip
安装(甚至在 Windows 中),具有相似的大小,并且在打包时需要类似的努力。
在我看来,这就像您在证明打包方法的合理性时可能会遇到的那种问题。
编辑:
刚找到一个 tar.gz
可能比轮子更好的例子。 CherryPy (https://pypi.python.org/pypi/CherryPy) 只为 Python 3.x 提供轮子,所以如果你想有一个本地存储库来为 Python 2.7 和 3.x 依赖项提供 CherryPy,存储压缩包似乎更有意义。这个对吗? (只是为了在讨论中添加一些 "case-based" 理由)
Advantages of wheels
• Faster installation for pure python and native C extension packages.
• Avoids arbitrary code execution for installation. (Avoids setup.py)
• Installation of a C extension does not require a compiler on Windows or OS X.
• Allows better caching for testing and continuous integration.
• Creates .pyc files as part of installation to ensure they match the python interpreter used.
• More consistent installs across platforms and machines.
确保轮子已安装。
python3 -m pip install wheel
这为我解答了(直接来自 wheel PEP):
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.
https://www.python.org/dev/peps/pep-0427/#rationale
请注意,我们所说的 tarball 是上面提到的 "sdists"。