[英]Pros and cons of sdist
What are the pros and cons of packaging a Python project using python setup.py sdist
, taking care of listing all files in MANIFEST.in instead of just creating an archive of the whole project tree? 使用python setup.py sdist
打包Python项目的优点和缺点,而不是仅创建整个项目树的归档文件,而要在MANIFEST.in中列出所有文件?
Creating an archive of the tree sounds simpler and less error-prone to me, but maybe I am missing something? 对我来说,创建树的存档听起来更简单且更不易出错,但是也许我遗漏了一些东西?
Answering my own question, sdist
creates a PKG-INFO
file inside the archive. 在回答我自己的问题时, sdist
在存档中创建了一个PKG-INFO
文件。 This file can be used by tools such as pip to know more about the package. 诸如pip之类的工具可以使用此文件来了解有关该软件包的更多信息。 Its content is a set of <key>: <value>
lines defined here: https://packaging.python.org/specifications/core-metadata/ . 它的内容是在此处定义的一组<key>: <value>
行: https : //packaging.python.org/specifications/core-metadata/ 。
It is basically a declarative version of the metadata provided to the call to setup()
in the setup.py
. 它基本上是在setup.py
提供给调用setup()
的元数据的声明性版本。
I haven't tried to upload a package built without a PKG-INFO file to PyPI, but I suspect it would fail because of the lack of PKG-INFO file. 我没有尝试将没有PKG-INFO文件的软件包上传到PyPI,但我怀疑由于缺少PKG-INFO文件而导致软件包失败。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.