gpt4 book ai didi

python - `setup.cfg` 是否已弃用?

转载 作者:行者123 更新时间:2023-12-03 23:27:45 24 4
gpt4 key购买 nike

我不是很清楚,setup.cfg 的状态是什么? .我正在为我的 other question 寻找解决方案关于 PEP 508 环境标记,我完全糊涂了。

在我看来,setup.cfg是对 setup.py 的改进,因为它是声明性的,不涉及运行任意代码以使软件包可安装,使分发恶意 Python 软件包变得更加困难,使运行 Python 软件包注册表等变得更加容易。

所以,here in setuptools docs提到 setuptools 在 30.3.0 (8 Dec 2016) 中获得了对 setup.cfg 的支持版本,这是相当新的。所以,这一定是一个新事物,对吧?

不完全的。 distutils had support for setup.cfg for a long time ,至少从 2.6 开始。已经9年了。

同时,here in wheel docs据说setup.cfg现在已弃用,最好通过 extras_require 提供环境标记范围。它提到了 setuptools,所以它不是关于 setup.cfg 的可能已弃用的 distutils 风格.

那么,究竟发生了什么?是 setup.cfg已弃用,还是最近的做事方式?

最佳答案

我想就最近的发展补充几点说明:

PEP 518仍处于临时状态,但我将其解释为邀请使用 pyproject.toml而不是 setup.cfg .引自 PEP:

There are two issues with setup.cfg used by setuptools as a general format. One is that they are .ini files which have issues as mentioned in the configparser discussion above. The other is that the schema for that file has never been rigorously defined and thus it's unknown which format would be safe to use going forward without potentially confusing setuptools installations.



来自 black's documentation :

PEP 518 defines pyproject.toml as a configuration file to store build system requirements for Python projects. With the help of tools like Poetry or Flit it can fully replace the need for setup.py and setup.cfg files.



pip 19.0已实现 PEP 517允许项目通过 pyproject.toml 指定构建后端.
setuptools有一个标题为“ Merge setup.cfg spec with pyproject.toml one and deprecate setup.py and setup.cfg”的未解决问题。然而, setuptools伙计们还没有决定这个。有一个 open discussion关于如何进行。

免责声明:我自己完全迷失在 Python 的包装丛林中。

关于python - `setup.cfg` 是否已弃用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44878600/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com