-
Notifications
You must be signed in to change notification settings - Fork 239
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
[FR] CIBW_BUILD_ISOLATION
or similar
#1580
Comments
Hm. Maybe we should also allow set environment variable only for build wheel steep? |
I wonder if a middle ground here, between it would give users the freedom to do change an option like build-isolation, and have some advantages over The downsides of CIBW_BUILD_FRONTEND_FLAGS are the API-leakage aspect of such an option (pip/build's API becomes part of our API). But I think we could alleviate this somewhat with documentation, "this option is intended for experimentation, we don't envisage this option being used as part of a production config". [1]: my thoughts on CIBW_BUILD_COMMAND from the discord, pasted here so it's all in one place
-- |
Hi @joerick, It allows to get the job done while avoiding the mental confusion that is to use |
The other thought I have on this is that at some point we're gonna make joerick@joerick5 ~> pipx run build -h
usage: build [-h] [--version] [--sdist] [--wheel] [--outdir OUTDIR] [--skip-dependency-check] [--no-isolation]
[--config-setting CONFIG_SETTING]
[srcdir]
A simple, correct Python build frontend.
By default, a source distribution (sdist) is built from {srcdir}
and a binary distribution (wheel) is built from the sdist.
This is recommended as it will ensure the sdist can be used
to build wheels.
Pass -s/--sdist and/or -w/--wheel to build a specific distribution.
If you do this, the default behavior will be disabled, and all
artifacts will be built from {srcdir} (even if you combine
-w/--wheel with -s/--sdist, the wheel will be built from {srcdir}).
positional arguments:
srcdir source directory (defaults to current directory)
options:
-h, --help show this help message and exit
--version, -V show program's version number and exit
--sdist, -s build a source distribution (disables the default behavior)
--wheel, -w build a wheel (disables the default behavior)
--outdir OUTDIR, -o OUTDIR
output directory (defaults to {srcdir}/dist)
--skip-dependency-check, -x
do not check that build dependencies are installed
--no-isolation, -n do not isolate the build in a virtual environment
--config-setting CONFIG_SETTING, -C CONFIG_SETTING
pass options to the backend. options which begin with a hyphen must be in the form of "--config-setting=--opt(=value)" or "-C--opt(=value)" The only two options that might be useful that we don't already expose are
These are good ideas. But I'm not sure if they're really solving the root cause, which is that people occasionally want to customise the actual wheel build step. (Part of me is still wondering if we just bite the bullet and implement CIBW_BUILD_COMMAND - that would provide the most flexibility, as long as it's clear that using such an option is experimental/outside of python packaging norms.) |
Sorry, I'll shut up in a minute, but perhaps a better idea than CIBW_BUILD_FRONTEND_FLAGS would be to take the same approach we took with the container-engine option, which is to nest the extra flags within the CIBW_BUILD_FRONTEND option. I kinda like that better, as it makes it clear that these are options to pip/build specifically, and it avoids creating another option. So I guess that would look like |
FYI, i've started work on a PR to do the above, the |
Thank you very much @joerick. |
It would be nice if we could have a
CIBW_BUILD_ISOLATION=false
, equivalent topython -m build --no-isolation
andpip 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 usecibuildwheel
; 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
(nobuild
equivalent as far as I know). However, I found thatPIP_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 howcibuildwheel
works, but nevertheless, very easy to forget and let it happen/difficult for beginners to figure it out)PIP_NO_BUILD_ISOLATION
is counter-intuitive: see PIP_NO_CACHE_DIR and PIP_NO_BUILD_ISOLATION behave opposite to how they read pip#5735When
PIP_NO_BUILD_ISOLATION=false
is set, every call topip install
(e.g. the ones inCIBW_BEFORE_BUILD
to 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 a
pip install
command) error prone. For example, the followingCIBW_BEFORE_BUILD
may result in errors (depending on the versions of Python/setuptools
/wheel
/pip
already present on the build container/VM):(Instead to make it work, after a few ours of debugging, you might have to split the command into a succession of independent
pip install
s).It would be better ifCIBW_BEFORE_BUILD
is not affected byPIP_NO_BUILD_ISOLATION
(it gives less margins for surprise/errors).CIBW_BUILD_ISOLATION=false
would 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 commandCIBW_BUILD_CMD
, as suggested in #442 (however that comes with a different set of considerations/issues as discussed in the other issue).The text was updated successfully, but these errors were encountered: