Python包装:pyproject.toml vs setup_requires中的构建要求
在某种复杂的python setup.py
配置中,通常需要已经存在的其他库才能执行 setuptools.setups.setup
。就我而言,这将是 setuptools> = 45.0
和 cython> = 0.29
。现在,我有两个选项来声明这些构建时间要求(不要将通常在 unignts.txt
文件中找到的标准包装安装要求混淆),以将该项目运送到PYPI:
- 手动编写该项目
setup_requires
参数中的要求作为setup.py
的一部分:
#setup.py
from setuptools import setup
#...
setup(
name='bla',
#...
setup_requires = ['setuptools>=45.0', 'cython>=0.29'],
)
- 将这些要求写入 pep518 :
#pyproject.toml
[build-system]
# Minimum requirements for the build system to execute.
requires = ["setuptools>=45.0", "cython>=0.29"]
它们是否可交换?应该使用哪一个,为什么?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建上述PEP是为了解决部分。 包装python 建议使用第二种方法。
The aforementioned PEP was created to address the limitations of the 1st approach that are listed in the Rationale section. Packaging Python recommends using the 2nd approach.