polka
polka

Reputation: 1529

pyproject.toml won't find project name with setuptools python -m build format

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.

Upvotes: 14

Views: 12802

Answers (2)

thor
thor

Reputation: 22510

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.

Upvotes: 0

sinoroc
sinoroc

Reputation: 22305

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:

Upvotes: 10

Related Questions