pyproject.toml 无法使用 setuptools python -m 构建格式找到项目名称

发布于 2025-01-15 03:38:01 字数 730 浏览 5 评论 0 原文

在 pyproject.toml 中向 Python 包提供名称的正确格式是什么?这是 pyproject.toml 文件:

[project]
name = "foobar"
version = "0.0.1"

[build-system]
requires = ["setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta"

使用 python -m build 调用的构建会导致以下错误。

running check
warning: check: missing required meta-data: name, url
warning: check: missing meta-data: either (author and author_email) or (maintainer and maintainer_email) should be supplied

基于这个reddit帖子问题我也遇到了同样的问题。

What is the correct format for supplying a name to a Python package in a pyproject.toml? Here's the pyproject.toml file:

[project]
name = "foobar"
version = "0.0.1"

[build-system]
requires = ["setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta"

A build called using python -m build results in the following error.

running check
warning: check: missing required meta-data: name, url
warning: check: missing meta-data: either (author and author_email) or (maintainer and maintainer_email) should be supplied

Based on this reddit post question I had the same issue.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光礼记 2025-01-22 03:38:01

更新

在提出问题时,setuptools不支持在pyproject.toml 文件(PEP 621)。所以无法回答这个问题。

现在,自版本 61.0.0 起,setuptools 支持 PEP 621:


原始答案

看来您正在尝试编写PEP 621 样式 pyproject.toml 与 setuptools 构建后端。

但是,截至目前,setuptools 尚不支持 PEP 621。这项工作正在进行中:

直到 PEP 621 支持到达 setuptools,可以:

Update

At the time the question was asked, setuptools did not have support for writing its configuration in a pyproject.toml file (PEP 621). So it was not possible to answer the question.

Now and since its version 61.0.0, setuptools has support for PEP 621:


Original answer

It seems that you are trying to write a PEP 621-style pyproject.toml with the setuptools build back-end.

But, as of now, setuptools does not have support for PEP 621 yet. The work is ongoing:

Until PEP 621 support arrives in setuptools, one can:

蓝梦月影 2025-01-22 03:38:01

如果您使用的是 Ubuntu,则根据此错误报告

在 Ubuntu 22.04 (Jammy) 上确保环境变量
安装 PEP621 之前的 DEB_PYTHON_INSTALL_LAYOUT=deb_system
具有 pip 和 setuptools 的兼容项目。

也就是说,执行 eg:

DEB_PYTHON_INSTALL_LAYOUT=deb_system pip install . 

而不是:

pip install .

否则,即使您已升级 setuptools (59.x) pip 中的 >setuptools

If you are using Ubuntu, then according to this bug report

On Ubuntu 22.04 (Jammy) ensure the environment variable
DEB_PYTHON_INSTALL_LAYOUT=deb_system before installing a PEP621
compliant project with pip and setuptools.

That is, do e.g.:

DEB_PYTHON_INSTALL_LAYOUT=deb_system pip install . 

instead of:

pip install .

Otherwise, the system may pick up the older version of setuptools (59.x) installed by apt even if you have upgraded setuptools in pip.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文