I'm currently trying to move our internal projects away from setup.py to pyproject.toml (PEP-518). I'd like to not use build backend specific configuration if possible, even though I do specify the backend in the [build-system] section by require'ing it.
The pyproject.toml files are more or less straight-forward translations of the setup.py files, with the metadata set according to PEP-621, including the dependencies. We are using setuptools_scm for the determination of the version, therefore the version field ends up in the dynamic section.
We used to set the packages parameter to setup in our setup.py files, but I couldn't find any corresponding field in pyproject.toml, so I simply omitted it.
When building the project using python3 -m build ., I end up with a package named UNKNOWN, even though I have the name field set in the [project] section. It seems that this breaks very early in the build:
$ python -m build . * Creating virtualenv isolated environment... * Installing packages in isolated environment... (setuptools, setuptools_scm[toml]>=6.2, wheel) * Getting dependencies for sdist... running egg_info writing UNKNOWN.egg-info/PKG-INFO .... I'm using python 3.8.11 and the following packages:
build==0.8.0 distlib==0.3.4 filelock==3.4.1 packaging==21.3 pep517==0.12.0 pip==22.0.4 platformdirs==2.4.0 pyparsing==3.0.9 setuptools==62.1.0 six==1.16.0 tomli==1.2.3 virtualenv==20.14.1 wheel==0.37.1 My (abbreviated) pyproject.toml looks like this:
[project] name = "coolproject" dependencies = [ 'pyyaml==5.3', 'anytree==2.8.0', 'pytest' ] dynamic = [ "version" ] [build-system] requires = ["setuptools", "wheel", "setuptools_scm[toml]>=6.2"] [tool.setuptools_scm] Any ideas?
build-backend? Does it work if you set it tobuild-backend = "setuptools.build_meta"? -- If not specified, the build front-end (pip) kind of defaults to invokingsetuptools.build_meta:__legacy__instead which is probably not what you want here.distandbuilddirectories) and try again. Maybe also try withoutsetuptools_scmfirst (make sure to setversion).dynamic = ["version"]withversion = "1.0", didgit init && git add . && git commit -m x, and ranpython -m build .... and gotcoolproject-1.0just fine.pip install --user pipas a regular user...