Skip to content
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

feat: use build by default #2321

Merged
merged 2 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cibuildwheel/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def build(options: Options, tmp_path: Path) -> None:

for config in python_configurations:
build_options = options.build_options(config.identifier)
build_frontend = build_options.build_frontend or BuildFrontendConfig("pip")
build_frontend = build_options.build_frontend or BuildFrontendConfig("build")
# uv doesn't support iOS
if build_frontend.name == "build[uv]":
msg = "uv doesn't support iOS"
Expand Down
2 changes: 1 addition & 1 deletion cibuildwheel/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def build_in_container(
log.build_start(config.identifier)
local_identifier_tmp_dir = local_tmp_dir / config.identifier
build_options = options.build_options(config.identifier)
build_frontend = build_options.build_frontend or BuildFrontendConfig("pip")
build_frontend = build_options.build_frontend or BuildFrontendConfig("build")
use_uv = build_frontend.name == "build[uv]"
pip = ["uv", "pip"] if use_uv else ["pip"]

Expand Down
2 changes: 1 addition & 1 deletion cibuildwheel/macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def build(options: Options, tmp_path: Path) -> None:

for config in python_configurations:
build_options = options.build_options(config.identifier)
build_frontend = build_options.build_frontend or BuildFrontendConfig("pip")
build_frontend = build_options.build_frontend or BuildFrontendConfig("build")
use_uv = build_frontend.name == "build[uv]"
uv_path = find_uv()
if use_uv and uv_path is None:
Expand Down
2 changes: 1 addition & 1 deletion cibuildwheel/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def build(options: Options, tmp_path: Path) -> None:

for config in python_configurations:
build_options = options.build_options(config.identifier)
build_frontend = build_options.build_frontend or BuildFrontendConfig("pip")
build_frontend = build_options.build_frontend or BuildFrontendConfig("build")
use_uv = build_frontend.name == "build[uv]" and can_use_uv(config)
log.build_start(config.identifier)

Expand Down
6 changes: 3 additions & 3 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ This option can also be set using the [command-line option](#command-line)
## Build customization

### `CIBW_BUILD_FRONTEND` {: #build-frontend}
> Set the tool to use to build, either "pip" (default for now), "build", or "build\[uv\]"
> Set the tool to use to build, either "build" (default), "build/[uv/]", or "pip"

Options:

Expand All @@ -658,8 +658,8 @@ Options:

Default: `pip`

Choose which build frontend to use. Can either be "pip", which will run
`python -m pip wheel`, or "build", which will run `python -m build --wheel`.
Choose which build frontend to use. Can either be "build", which will run
`python -m build --wheel`, or "pip", which will run `python -m pip wheel`.

You can also use "build\[uv\]", which will use an external [uv][] everywhere
possible, both through `--installer=uv` passed to build, as well as when making
Expand Down
5 changes: 5 additions & 0 deletions test/test_before_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def test(tmp_path):
"""python -c "import sys; open('{project}/pythonversion_bb.txt', 'w').write(sys.version)" && """
f'''python -c "import sys; open('{{project}}/pythonprefix_bb.txt', 'w').write({SYS_PREFIX})"'''
)
frontend = "build"
if utils.platform != "pyodide":
before_build = f"python -m pip install setuptools && {before_build}"
frontend = f"{frontend};args: --no-isolation"

# build the wheels
actual_wheels = utils.cibuildwheel_run(
Expand All @@ -52,6 +56,7 @@ def test(tmp_path):
# write python version information to a temporary file, this is
# checked in setup.py
"CIBW_BEFORE_BUILD": before_build,
"CIBW_BUILD_FRONTEND": frontend,
},
)

Expand Down
Loading