build: build does not validate that the "source directory" argument is a valid source directory
If I run build in an empty directory (or any directory that isn’t a Python project), rather than reporting the error, the tool appears to run setuptools and creates an empty project called UNKNOWN. If there’s no pyproject.toml, I guess it’s assuming setuptools as a fallback. But if there’s no setup.py or setup.cfg this is clearly incorrect, and so should fail.
As it stands, the build runs and results in unwanted (and useless) build, dist and UNKNOWN.egg-info directories being created in my project. Luckily, I wasn’t already using build or dist as actual directories for my code…
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (15 by maintainers)
Your build system validation logic is also subtly different than what we have in build, see https://github.com/pypa/build/blob/5a3c5243a2135236f207da3a4b6401e1561f952d/src/build/__init__.py#L204-L218.
Yes, I was fine with this not being added when I realized that pip doesn’t support it; currently only build supports a setup.cfg only project with no pyproject.toml. I think it’s fine to match pip here. My only remaining point was that it might be mentioned in the changlog as a changed behavior, but it could be only people like me who throw together an example to check the behavior ( I think I did this when adding checks to cibuildwheel), but I’m pretty sure any real project would also require that a pip install without running
buildfirst works (such as in their test suite, etc). If that’s the only case, then a mention is likely not needed.