-
Notifications
You must be signed in to change notification settings - Fork 74
Description
I just moved a project from old scikit-build
and tox3
to scikit-build-core
and tox4
- the improved caching on both sides has taken my test time from several minutes to several seconds, so very happy about that. Unfortunately, scikit-build-core
's clever use of get_requires_for_build_wheel
to add cmake
etc. only when they are not already available is backfiring somewhat.
The first run works perfectly, with tox
installing cmake
in the build environment. For the second run scikit-build-core
finds that cmake
is available in its path and so does not request it in get_requires_for_build_wheel()
. tox
sees that the requirements have changed, and scraps the build env (and promptly crashes, but that is a secondary issue, I think). So I think that a better solution would be for scikit-build-core
to check if cmake
is available through the env (rather than anywhere else) and if so then it should continue to say that it requires the package. Since the package is already installed, it won't make a material difference to the run time of anything for pip
to decide it doesn't need to do anything, but it will stop tox
from getting confused about the changing requirements. Note that if I add cmake
to the list of build requirements in pyproject.toml
(so scikit-build-core
never asks for it and never changes its mind) then the problem goes away.
I guess that there are some technical questions about deciding whether cmake
is coming from the environment, but the simplest way is probably just to import cmake
and check for an error. This could be a short-circuit at the top of GetRequires.cmake(). If cmake
can be imported then yield f"cmake>={cmake_min}"
. @henryiii I am happy to submit a PR if this change meets with your approval.