构建 Python 包时,有没有办法将 files/folders 包含在源代码分发中,而不是 wheel

When building a Python package, is there a way to include files/folders in the source distribution, but not the wheel

我有一个依赖项,它是我项目构建步骤的一部分 (pipenv)。该包中的代码需要 运行 在 setup.py 之前。出于这个原因,我将它作为我的包的一部分包含在 vendor 文件夹中。

我知道 install_requires 中包含该软件包会将其包含在源代码分发中,但不会包含在 wheel 中。我不能这样做的原因是因为需要该包来解析构成 install_requires.

的信息

有什么方法可以将任意文件和文件夹作为源代码分发的一部分,而不是 wheel?

什么是installed_requires?你是说 install_requires 吗?在那种情况下你就完全错了,那个关键字没有在 source dist(或 wheels)中放置任何东西,它指定了这个版本需要安装的其他发行版。

文件 MANIFEST.in 控制进入 sdist 的内容。阅读 https://packaging.python.org/guides/using-manifest-in/#using-manifest-in