diff --git a/crates/uv/src/commands/project/init.rs b/crates/uv/src/commands/project/init.rs index 87d612377dbc..7ccb61ba9f70 100644 --- a/crates/uv/src/commands/project/init.rs +++ b/crates/uv/src/commands/project/init.rs @@ -261,6 +261,10 @@ async fn init_project( description = "Add your description here"{readme} requires-python = "{requires_python}" dependencies = [] + + [build-system] + requires = ["hatchling"] + build-backend = "hatchling.build" "#, readme = if no_readme { "" } else { "\nreadme = \"README.md\"" }, requires_python = requires_python.specifiers(), @@ -269,7 +273,7 @@ async fn init_project( fs_err::create_dir_all(path)?; fs_err::write(path.join("pyproject.toml"), pyproject)?; - // Create `src/{name}/__init__.py` if it does not already exist. + // Create `src/{name}/__init__.py`, if it doesn't exist already. let src_dir = path.join("src").join(&*name.as_dist_info_name()); let init_py = src_dir.join("__init__.py"); if !init_py.try_exists()? { diff --git a/crates/uv/tests/init.rs b/crates/uv/tests/init.rs index c60fc87f7621..bbf693e6407e 100644 --- a/crates/uv/tests/init.rs +++ b/crates/uv/tests/init.rs @@ -39,6 +39,10 @@ fn init() -> Result<()> { readme = "README.md" requires-python = ">=3.12" dependencies = [] + + [build-system] + requires = ["hatchling"] + build-backend = "hatchling.build" "### ); }); @@ -97,6 +101,10 @@ fn init_no_readme() -> Result<()> { description = "Add your description here" requires-python = ">=3.12" dependencies = [] + + [build-system] + requires = ["hatchling"] + build-backend = "hatchling.build" "### ); }); @@ -137,6 +145,10 @@ fn init_current_dir() -> Result<()> { readme = "README.md" requires-python = ">=3.12" dependencies = [] + + [build-system] + requires = ["hatchling"] + build-backend = "hatchling.build" "### ); }); @@ -200,6 +212,10 @@ fn init_dot_args() -> Result<()> { readme = "README.md" requires-python = ">=3.12" dependencies = [] + + [build-system] + requires = ["hatchling"] + build-backend = "hatchling.build" "### ); }); @@ -276,6 +292,10 @@ fn init_workspace() -> Result<()> { readme = "README.md" requires-python = ">=3.12" dependencies = [] + + [build-system] + requires = ["hatchling"] + build-backend = "hatchling.build" "### ); }); @@ -368,6 +388,10 @@ fn init_workspace_relative_sub_package() -> Result<()> { readme = "README.md" requires-python = ">=3.12" dependencies = [] + + [build-system] + requires = ["hatchling"] + build-backend = "hatchling.build" "### ); }); @@ -461,6 +485,10 @@ fn init_workspace_outside() -> Result<()> { readme = "README.md" requires-python = ">=3.12" dependencies = [] + + [build-system] + requires = ["hatchling"] + build-backend = "hatchling.build" "### ); }); @@ -539,6 +567,10 @@ fn init_invalid_names() -> Result<()> { readme = "README.md" requires-python = ">=3.12" dependencies = [] + + [build-system] + requires = ["hatchling"] + build-backend = "hatchling.build" "### ); }); @@ -671,6 +703,10 @@ fn init_project_inside_project() -> Result<()> { readme = "README.md" requires-python = ">=3.12" dependencies = [] + + [build-system] + requires = ["hatchling"] + build-backend = "hatchling.build" "### ); }); @@ -969,6 +1005,10 @@ fn init_requires_python_workspace() -> Result<()> { readme = "README.md" requires-python = ">=3.10" dependencies = [] + + [build-system] + requires = ["hatchling"] + build-backend = "hatchling.build" "### ); }); @@ -1019,6 +1059,10 @@ fn init_requires_python_version() -> Result<()> { readme = "README.md" requires-python = ">=3.8" dependencies = [] + + [build-system] + requires = ["hatchling"] + build-backend = "hatchling.build" "### ); }); @@ -1070,6 +1114,10 @@ fn init_requires_python_specifiers() -> Result<()> { readme = "README.md" requires-python = "==3.8.*" dependencies = [] + + [build-system] + requires = ["hatchling"] + build-backend = "hatchling.build" "### ); });