mesonbuild / meson-python

Meson PEP 517 Python build backend
https://mesonbuild.com/meson-python/
MIT License
125 stars 65 forks source link

Add ignore files to dist directory #576

Closed inklesspen closed 7 months ago

inklesspen commented 7 months ago

meson-python adds .gitignore and .hgignore files to the build directory, but not the dist directory. however I surely don't want to check my sdist and wheel into source control. meson-python should add the ignore files to the dist directory also.

eli-schwartz commented 7 months ago

This is an interesting idea and sounds useful. Note that the build directory is handled by meson, not meson-python, so it makes sense in a way that the latter didn't support it by default. Easy enough to do, however. :)

inklesspen commented 7 months ago

the ignore files have a comment saying they're added by meson-python, though…

dnicolodi commented 7 months ago

The dist directory is not created by meson-python. It is responsibility of the build front-end to create it. meson-python only creates a build directory in the project root when building an editable wheel (and places .gitignore and .hgignore files there because the Meson build directory is created as a subdirectory of it, named after the Python interpreter being used for the build).

rgommers commented 7 months ago

Seems like a good idea at first sight, but agreed it's a frontend thing. Seems to have been tried by build and it was found to cause issues with some build backends (at least Poetry will have hiccups it looks like): https://github.com/pypa/build/issues/320.

eli-schwartz commented 7 months ago

That's a problem with build frontends being unable to detect whether the build backend uses git in a semantically incorrect and fundamentally broken manner.

Since meson-python is neither poetry nor hatchling, it is safe to use a semantically correct software design -- and meson-python knows they even if build doesn't.

IMHO it's perfectly fine for meson-python to create a file inside the dist/ directory if it sees that it's empty.

The dist directory is not created by meson-python. It is responsibility of the build front-end to create it.

Wrong! Terribly, tragically wrong. The spec (PEP 517) is broken.

See #273 / #274 for details. I fixed this bug and meson-python now creates the dist/ directory.