纯Python软件包的内部发行版有什么意义?

What is the point of built distributions for pure Python packages?

一个人可以共享Python作为源发行版(.tar.gz格式)或构建的发行版(wheels格式)。

据我了解,构建发行版的要点是:

  • 节省时间:编译可能会非常耗时。我们可以在服务器上执行一次此操作,然后将其共享给许多用户。
  • 降低需求:用户不必安装编译器

但是,bdist文件的这两个参数似乎不适用于纯python软件包。不过,我看到natsort既有sdist也有bdist。以bdist格式共享纯Python包有什么优势?


来自pythonwheels.com:

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 Linux, Windows or macOS.
  • 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.
  • 因此,对于我来说,我认为第一点和第二点对于纯Python软件包最有意义。它更小,更快,也更安全。