Skip to content

Commit 4a05d76

Browse files
Always use --build-backend hatch for uv init subprocesses from `u… (#901)
* Always use `--build-backend hatch` for `uv init` subprocesses from `usethis init` * Update tests/usethis/_integrations/uv/test_init.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 39206d3 commit 4a05d76

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/usethis/_integrations/uv/init.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ def opinionated_uv_init() -> None:
1919
tick_print("Writing 'pyproject.toml' and initializing project.")
2020
try:
2121
call.call_uv_subprocess(
22-
["init", "--lib", usethis_config.cpd().as_posix()],
22+
[
23+
"init",
24+
"--lib",
25+
"--build-backend",
26+
"hatch",
27+
usethis_config.cpd().as_posix(),
28+
],
2329
change_toml=True,
2430
)
2531
except UVSubprocessFailedError as err:

tests/usethis/_integrations/uv/test_init.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ def mock_call_uv_subprocess(*_: Any, **__: Any) -> None:
4747
):
4848
opinionated_uv_init()
4949

50+
def test_build_backend_is_hatch(self, tmp_path: Path):
51+
with change_cwd(tmp_path), PyprojectTOMLManager() as manager:
52+
# Act
53+
opinionated_uv_init()
54+
55+
# Assert
56+
assert manager[["build-system", "build-backend"]] == "hatchling.build"
57+
5058

5159
class TestEnsurePyprojectTOML:
5260
def test_created(self, tmp_path: Path, capfd: pytest.CaptureFixture[str]):

0 commit comments

Comments
 (0)