-
Notifications
You must be signed in to change notification settings - Fork 293
Description
It would be nice if we could have a CIBW_BUILD_ISOLATION=false, equivalent to python -m build --no-isolation and pip wheel --no-deps --no-build-isolation.
The context for this FR is testing: some projects (like build-backends or build-backend plugins, e.g. setuptools-rust) have integration tests that use cibuildwheel; and during those tests we want to install the working versions of one of the build requirements from the source directory instead of fetching from PyPI.
The only alternative that we have nowadays is PIP_NO_BUILD_ISOLATION (no build equivalent as far as I know). However, I found that PIP_NO_BUILD_ISOLATION is tricky to use (in PyO3/setuptools-rust#352, it took me a long time to figure out how to make it work and solve the errors). I can highlight the following reasons:
-
It is not supported by
build -
You have to set it inside
CIBW_ENVIRONMENT(forgetting to do that is a silly mistake if you understand howcibuildwheelworks, but nevertheless, very easy to forget and let it happen/difficult for beginners to figure it out) -
PIP_NO_BUILD_ISOLATIONis counter-intuitive: seePIP_NO_BUILD_ISOLATIONbehaves opposite to how it reads pip#5735 -
When
PIP_NO_BUILD_ISOLATION=falseis set, every call topip install(e.g. the ones inCIBW_BEFORE_BUILDto install the build dependencies) will also be subject to the "no isolation" rule.
This make a supposedly simple operation (i.e., installing build dependencies using apip installcommand) error prone. For example, the followingCIBW_BEFORE_BUILDmay result in errors (depending on the versions of Python/setuptools/wheel/pipalready present on the build container/VM):CIBW_BEFORE_BUILD: pip install -U pip>=23.2.1 setuptools>=68.0.0 wheel>=0.41.1 -e .
(Instead to make it work, after a few ours of debugging, you might have to split the command into a succession of independent
pip installs).It would be better ifCIBW_BEFORE_BUILDis not affected byPIP_NO_BUILD_ISOLATION(it gives less margins for surprise/errors).
CIBW_BUILD_ISOLATION=falsewould be better because it would not affectCIBW_BEFORE_BUILD(less margin for surprise/errors).
An alternative to CIBW_BUILD_ISOLATION=true, would be allowing customising the build command CIBW_BUILD_CMD, as suggested in #442 (however that comes with a different set of considerations/issues as discussed in the other issue).