-
-
Notifications
You must be signed in to change notification settings - Fork 307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hatchling reads .gitignore files outside the project tree, possibly generating broken wheels #1069
Comments
Oh, I think it also reads |
Hello again! Yes I plan to improve this situation next year. |
Thanks! Would it make sense, in the meantime, to throw an error if all package files end up being ignored? This could at least make it easier to figure out what's wrong. |
Do you mean if there was no file that matched for inclusion in the artifact like a wheel? |
Yes. |
I ran into this problem with It actually is a The workaround is to just put a I also have my home directory set up as git repo and have a (Stopping at the |
#903 reported the same issue in 2023-jul-04 , and is about 5 months ahead of this issue and https://bugs.gentoo.org/918677 |
I think #1643 should fix this. |
Originally reported as https://bugs.gentoo.org/918677
Hatchling aggressively scans parent directories for
.gitignore
files, going as far as to read files that are outside the project tree (i.e. abovepyproject.toml
), even if they are not inside any git repository (which is against the principle of least surprise). If one of these files include the project directory, then hatchling creates an empty wheel.To reproduce:
The result is:
I think there are two issues here:
.gitignore
are being used even if they're not inside a git repository. In this case, the user assumed that renaming.git
should be sufficient not to have packages affected by.git*
files..gitignore
are being used even when they explicitly ignore the whole project tree. This naturally implies (at least to git) that the project tree is not a part of the git repository, so hatchling shouldn't be using any rules from that repository.The text was updated successfully, but these errors were encountered: