This repository is a demo project for a bug with hatch described in this issue.
Steps to reproduce:
- Clone project
- Add file with the name
ignored-file.txt
inside thestatic
directory (File is in .gitignore and therefore cannot be checked in) - Set
ignore-vcs
tofalse
in thepyproject.toml
file - Build the project and validate that the distribution does not contain file
static/ignored-file.txt
- Set
ignore-vcs
totrue
line in thepyproject.toml
file - Build the project and validate that the distribution does still not contain the file
static/ignored-file.txt
(This is the bug that should be reproduced.) - Remove
.gitignore
file - Build the project and validate that the distribution now does contain the file
static/ignored-file.txt
Builds are run with python -m build .
.
Either I am using the feature wrong or there is a bug with this functionality.
If the ignore-vcs
attribute is used differently, as mentioned by z0gSh1u here the flag actually works as desired.
But in my opinion this still leaves room for improvement on either the documentation (which gives an example with the flag at [tool.hatch.build.targets.sdist]
) or a more robust implementation that handles this case better.