From 973946b1720a6d6e0665cc89cc786f9369652058 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Mon, 1 Jul 2024 20:15:09 -0400 Subject: [PATCH] fix: support --no-isolation with build[uv] (#1889) * fix: support --no-isolation with build[uv] Signed-off-by: Henry Schreiner * docs: mention caveat Signed-off-by: Henry Schreiner --------- Signed-off-by: Henry Schreiner --- cibuildwheel/linux.py | 2 +- cibuildwheel/macos.py | 2 +- cibuildwheel/windows.py | 2 +- docs/options.md | 6 ++++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cibuildwheel/linux.py b/cibuildwheel/linux.py index c0b623aa..39a014c5 100644 --- a/cibuildwheel/linux.py +++ b/cibuildwheel/linux.py @@ -282,7 +282,7 @@ def build_in_container( if not 0 <= build_options.build_verbosity < 2: msg = f"build_verbosity {build_options.build_verbosity} is not supported for build frontend. Ignoring." log.warning(msg) - if use_uv: + if use_uv and "--no-isolation" not in extra_flags and "-n" not in extra_flags: extra_flags += ["--installer=uv"] container.call( [ diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index d51feedb..69dbd118 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -505,7 +505,7 @@ def build(options: Options, tmp_path: Path) -> None: if not 0 <= build_options.build_verbosity < 2: msg = f"build_verbosity {build_options.build_verbosity} is not supported for build frontend. Ignoring." log.warning(msg) - if use_uv: + if use_uv and "--no-isolation" not in extra_flags and "-n" not in extra_flags: extra_flags.append("--installer=uv") call( "python", diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index a3da550d..94ff01cf 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -441,7 +441,7 @@ def build(options: Options, tmp_path: Path) -> None: if not 0 <= build_options.build_verbosity < 2: msg = f"build_verbosity {build_options.build_verbosity} is not supported for build frontend. Ignoring." log.warning(msg) - if use_uv: + if use_uv and "--no-isolation" not in extra_flags and "-n" not in extra_flags: extra_flags.append("--installer=uv") call( "python", diff --git a/docs/options.md b/docs/options.md index 946c8ee9..0906d923 100644 --- a/docs/options.md +++ b/docs/options.md @@ -657,6 +657,12 @@ optional `args` option. will change the default to [build][], in line with the PyPA's recommendation. If you want to try `build` before this, you can use this option. +!!! warning + If you are using `build[uv]` and are passing `--no-isolation` or `-n`, we + will detect this and avoid passing `--installer=uv` to build, but still + install all packages with uv. We do not currently detect combined short + options, like `-xn`! + [pip]: https://pip.pypa.io/en/stable/cli/pip_wheel/ [build]: https://github.com/pypa/build/ [uv]: https://github.com/astral-sh/uv