Skip to content
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
8 changes: 7 additions & 1 deletion src/usethis/_integrations/uv/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ def opinionated_uv_init() -> None:
tick_print("Writing 'pyproject.toml' and initializing project.")
try:
call.call_uv_subprocess(
["init", "--lib", usethis_config.cpd().as_posix()],
[
"init",
"--lib",
"--build-backend",
"hatch",
usethis_config.cpd().as_posix(),
],
change_toml=True,
)
except UVSubprocessFailedError as err:
Expand Down
8 changes: 8 additions & 0 deletions tests/usethis/_integrations/uv/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ def mock_call_uv_subprocess(*_: Any, **__: Any) -> None:
):
opinionated_uv_init()

def test_build_backend_is_hatch(self, tmp_path: Path):
with change_cwd(tmp_path), PyprojectTOMLManager() as manager:
# Act
opinionated_uv_init()

# Assert
assert manager[["build-system", "build-backend"]] == "hatchling.build"


class TestEnsurePyprojectTOML:
def test_created(self, tmp_path: Path, capfd: pytest.CaptureFixture[str]):
Expand Down
Loading