feat: option to build directly with uv (#2322)
* feat: option to build directly with uv Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> tests: add uv to tests Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> fix: uv doesn't pick special Pythons at the top of the path Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> fix: set uv build constraints too Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> fix: uv doesn't support PyPy 3.8 Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> tests: add pyproject.toml for failing test Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Revert "tests: add pyproject.toml for failing test" This reverts commit 619bde368a67dfdd8f02dc33a1525c27bc8cbe91. tests: skip uv output test Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * tests: uv was in the wrong fixture Signed-off-by: Henry Schreiner <henryfs@princeton.edu> * fix: from @trim21 Signed-off-by: Henry Schreiner <henryfs@princeton.edu> * tests: improve skipping Signed-off-by: Henry Schreiner <henryfs@princeton.edu> * fix: some fixes from copilot review Signed-off-by: Henry Schreiner <henryfs@princeton.edu> --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
This commit is contained in:
@@ -271,7 +271,7 @@ def setup_python(
|
||||
if build_frontend == "build[uv]" and not can_use_uv(python_configuration):
|
||||
build_frontend = "build"
|
||||
|
||||
use_uv = build_frontend == "build[uv]"
|
||||
use_uv = build_frontend in {"build[uv]", "uv"}
|
||||
uv_path = find_uv()
|
||||
|
||||
log.step("Setting up build environment...")
|
||||
@@ -386,6 +386,8 @@ def build(options: Options, tmp_path: Path) -> None:
|
||||
if not python_configurations:
|
||||
return
|
||||
|
||||
uv_path = find_uv()
|
||||
|
||||
try:
|
||||
before_all_options_identifier = python_configurations[0].identifier
|
||||
before_all_options = options.build_options(before_all_options_identifier)
|
||||
@@ -403,8 +405,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
|
||||
|
||||
use_uv = build_frontend.name == "build[uv]" and can_use_uv(config)
|
||||
use_uv = build_frontend.name in {"build[uv]", "uv"} and can_use_uv(config)
|
||||
log.build_start(config.identifier)
|
||||
|
||||
identifier_tmp_dir = tmp_path / config.identifier
|
||||
@@ -501,6 +502,18 @@ def build(options: Options, tmp_path: Path) -> None:
|
||||
*extra_flags,
|
||||
env=env,
|
||||
)
|
||||
case "uv":
|
||||
assert uv_path is not None
|
||||
call(
|
||||
uv_path,
|
||||
"build",
|
||||
"--python=python",
|
||||
build_options.package_dir,
|
||||
"--wheel",
|
||||
f"--out-dir={built_wheel_dir}",
|
||||
*extra_flags,
|
||||
env=env,
|
||||
)
|
||||
case _:
|
||||
assert_never(build_frontend)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user