scikit-build-core icon indicating copy to clipboard operation
scikit-build-core copied to clipboard

Option to run more in the SDist step?

Open henryiii opened this issue 1 year ago • 3 comments
trafficstars

See #766, it would be nice if we could have header only packages just build for the SDist step. Might require an option to run cmake install in the SDist step.

henryiii avatar Jul 30 '24 14:07 henryiii

Hmm, wouldn't cpack be more appropriate for such sdist step? Granted I never use cpack myself and that one is a weird one for users to get right.

But then, what scenario do you have in mind for this one? For header-only I think it would still be good to make a no-arch wheel, but it would depend heavily on #831 idea.

My view on this is that the headers can be generated or shipped with specific macros in the Config.cmake file, so it would fit the wheel usage, as opposed to the sdist where you are able to provide the CMake cache variables to use. It is of course weird that the header files are in the wheel, but wouldn't it need to be in that form in order to support non-header-only packages?

LecrisUT avatar Jul 30 '24 14:07 LecrisUT

I'm thinking of pybind11 and nanobind, specifically, which ship a *Config.cmake file. They place it in the correct location so cmake.prefix isn't necessary, scikit-build-core will find it without an entry point due to site-packages. cmake.prefix is only needed if the find name doesn't match the package name, and the new cmake.root or whatever will only be needed if the config files have a lib vs. lib64 in the structure.

It might be nice if those could produce an SDist that would be able to make a wheel without needing CMake. But both currently require CMake for the wheel, and both produce pure wheels so most users won't care about the SDist, so it's pretty minor.

henryiii avatar Jul 30 '24 14:07 henryiii

Ah, I guess you are making site_package folders part of the CMAKE_PREFIX_PATH and relying on the search using:

<prefix>/<name>*/(lib/<arch>|lib*|share)/cmake/<name>*/

Well, it seems like lib vs lib64 is irrelevant there based on the rule there. Are both Python_SITELIB and Python_SITEARCH searched in those cases?

About the sdist vs wheel, I was considering how would the user be using it. Let's say they have

[build-system]
requires = [scikit-build-core, pybind11]

Wouldn't pybind11 be built or downloaded from wheel regardless such that the *Config.cmake file are never consumed from the sdist?

LecrisUT avatar Jul 30 '24 15:07 LecrisUT