setup.cfg是否已弃用? [英] Is `setup.cfg` deprecated?

查看:373
本文介绍了setup.cfg是否已弃用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对我来说, setup.cfg 的状态还不是很清楚。我正在寻找有关PEP 508环境标记的其他问题的解决方案,我感到非常困惑。

It's not completely clear to me, what is the status of setup.cfg. I am looking for solutions for my other question about PEP 508 environment markers, and I became totally confused.

对我来说, setup.cfg 似乎是对 setup.py ,因为它是声明性的,所以不涉及运行任意代码以使程序包可安装,从而使得分发恶意Python程序包更加困难,使运行Python程序包注册表等更加容易。

To me it seems that setup.cfg is an improvement over setup.py, because it's declarative, does not involve running arbitrary code to make package installable, makes it harder to distribute malicious Python packages, makes it easier to run Python package registries etc.

因此,此处在 setuptools docs 中提到在 30.3.0(2016年12月8日)版本,这是最近的版本。所以,这一定是新事物,对吧?

So, here in setuptools docs it's mentioned that setuptools got support for setup.cfg in 30.3.0 (8 Dec 2016) version, which is quite recent. So, this has to be a new thing, right?

不是。 distutils 支持 setup.cfg 很长时间,至少从2.6开始。已经9年了。

Not quite. distutils had support for setup.cfg for a long time, at least since 2.6. It's been 9 years already.

同时, wheel 文档中,据说 setup.cfg 是现在已弃用,最好通过 extras_require 参数提供环境标记。而且它提到了setuptools,因此它不是 setup.cfg 可能已弃用的distutils风格。

At the same time, here in wheel docs it's been said that setup.cfg is now deprecated, and it's preferred to provide environment markers via extras_require parameter. And it mentions setuptools, so it isn't about possibly-deprecated distutils flavor of setup.cfg.

所以,实际上是怎么回事?是不推荐使用 setup.cfg 还是最新的处理方式?

So, what is actually going on? Is setup.cfg deprecated, or the most recent way to do things?

推荐答案

我想添加一些有关最新发展的注释:

I'd like to add a few notes on recent developments:

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

PEP 518 is still in provisional status, but I'm interpreting it as an invitation to use pyproject.toml instead of setup.cfg. Quoting from the PEP:


setup.cfg 使用了两个问题setuptools作为一般的
格式。一种是它们是 .ini 文件,它们具有 configparser 上面的讨论。另一个是该文件的
模式从未经过严格定义,因此未知的
将来会安全使用哪种格式,而不会引起
混淆setuptools安装。

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的文档


PEP 518 pyproject.toml 定义为配置文件,以存储Python项目的构建
系统要求。借助
之类的工具诗歌调整,它可以完全替代 setup.py
<$ c的需求$ c> setup.cfg
文件。

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 指定构建后端。

pip 19.0 implemented PEP 517 to allow projects to specify a build backend via pyproject.toml.

setuptools 有一个未解决的问题,标题为 将setup.cfg规范与pyproject.toml合并,并弃用setup.py和setup.cfg 。但是, setuptools 的家伙们尚未决定。关于如何进行公开讨论

setuptools has an open issue titled "Merge setup.cfg spec with pyproject.toml one and deprecate setup.py and setup.cfg". However, setuptools guys have not yet decided on this. There is an open discussion on how to proceed.

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

Disclaimer: I feel totally lost in Python's packaging jungle myself.

这篇关于setup.cfg是否已弃用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆