scikit-build / scikit-build-core

A next generation Python CMake adaptor and Python API for plugins
https://scikit-build-core.readthedocs.io
Apache License 2.0
241 stars 49 forks source link

feat: ignore-vcs option #277

Open zerothi opened 1 year ago

zerothi commented 1 year ago

.gitignore is for statuses of the git workflow, and has nothing to do with content in distributable packages.

It also seems to me that there is no way of disabling the .gitignore usage as per https://github.com/scikit-build/scikit-build-core/issues/274. I.e. the file is still used, but one can correct excluded files by explicitly adding them.

I would really recommend removing this feature as it goes against the configurability of the package.

Sorry to be blunt here...

A recommendation could be to follow the authors field as normally used:

sdist.exclude = [{file = '.gitignore'}, "other-regex*"]

Or similar.

henryiii commented 1 year ago

We don’t use .gitignore for the wheel. We use it for the SDist. Gitignore is a file for describing what is considered part of the source. An SDist is nearly like a git repo. You might want further filtering, maybe taking out CI files as an optimization, but it’s a great starting point; many projects won’t need anything but a good gitignore. This (and several other decisions) are designed after the popular “hatchling” backend.

There should and will be an option to select a different file or no file, but (IIRC, currently on vacation) I think you can select * then exclude everything manually, which basically ignores your gitignore.

zerothi commented 1 year ago

Ok. So does scikit-build-core have the same options as is present for hatchling? I.e. can I do:

# A)
[tool.hatch.build]
ignore-vcs = true
# B)
[tool.scikit-build]
ignore-vcs = true

or not?

henryiii commented 1 year ago

Not yet, but probably soon.

At the moment, the model is to describe the difference between SDist & vcs, which is usually at most a few lines. A proper ignore list would be really long, ignoring things like __pycache__, editor files, OS files, dist folder, venv folders, etc. Basically everything in your current gitignore will need to be in your ignore list if you don’t use the git ignore.

I’d recommend adding check-sdist to your static checks, with the —inject-junk option enabled, especially if you disable vcs ignores once the option is added.