Python包装:轮子vs压缩包(tar.gz) [英] Python packaging: wheels vs tarball (tar.gz)

查看:144
本文介绍了Python包装:轮子vs压缩包(tar.gz)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与鸡蛋相比,滚轮的优势显而易见(请参见为什么不加鸡蛋? https://pypi.python .org/pypi/wheel ).

The advantage of wheels over eggs is clear (see section why not egg? https://pypi.python.org/pypi/wheel).

但是,对我来说,尚不完全清楚使用轮子比tar.gz有什么好处.我可能会错过一些明显的东西,例如它们相同". 如我所见,它们都可以直接使用pip进行安装(即使在Windows中也是如此),具有相似的尺寸,并且在包装上也需要类似的工作. 在我看来,听起来像是在证明包装方法合理时可能会遇到的问题.

However, it is not entirely clear to me what is the advantage of using wheels over tar.gz. I might be missing something obvious like "they are the same". As I see it both can be installed directly using pip (even in Windows), have similar size and when packaging require a similar effort. It sounds to me like the kind of questions you might get when justifying a packaging methodology.

刚刚找到了一个示例,其中tar.gz可能比转轮更好. CherryPy( https://pypi.python.org/pypi/CherryPy )提供了适用于Python 3的轮子仅限.x,因此,如果您想拥有一个本地存储库来为Python 2.7和3.x依赖项提供CherryPy,似乎更有意义的是存储tarball.这样对吗? (只是在讨论中添加了一些基于案例"的理由)

Just found an example where tar.gz might be better than wheels. CherryPy (https://pypi.python.org/pypi/CherryPy) provides wheels for Python 3.x only, so if you want to have a local repository to serve CherryPy for Python 2.7 and 3.x dependencies, it seems to make more sense to store the tarball. Is this correct? (just to add a couple of "case-based" justification to the discussion)

推荐答案

这为我回答了这个问题(直接来自车轮PEP):

This answered it for me (directly from the wheel PEP):

Python需要一种比sdist更易于安装的软件包格式. Python的sdist包由distutils和定义,并且需要distutils和 setuptools构建系统,运行任意代码以构建和安装, 并重新编译代码,以便可以将其安装到新的 虚拟环境这种混合构建安装的系统速度很慢,很难 维护并阻碍构建系统和安装程序的创新.

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尝试通过提供更简单的方法来解决这些问题 构建系统和安装程序之间的接口.车轮二进制 软件包格式使安装人员不必了解构建 系统,通过分摊许多安装的编译时间来节省时间, 并且无需在目标中安装构建系统 环境.

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".

Note the tarballs we're speaking of are what are referred to as "sdists" above.

这篇关于Python包装:轮子vs压缩包(tar.gz)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆