Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use hatchling rather than implicit setuptools default #5527

Merged
merged 1 commit into from
Jul 29, 2024
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
6 changes: 5 additions & 1 deletion crates/uv/src/commands/project/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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()? {
Expand Down
48 changes: 48 additions & 0 deletions crates/uv/tests/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ fn init() -> Result<()> {
readme = "README.md"
requires-python = ">=3.12"
dependencies = []

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
"###
);
});
Expand Down Expand Up @@ -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"
"###
);
});
Expand Down Expand Up @@ -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"
"###
);
});
Expand Down Expand Up @@ -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"
"###
);
});
Expand Down Expand Up @@ -276,6 +292,10 @@ fn init_workspace() -> Result<()> {
readme = "README.md"
requires-python = ">=3.12"
dependencies = []

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
"###
);
});
Expand Down Expand Up @@ -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"
"###
);
});
Expand Down Expand Up @@ -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"
"###
);
});
Expand Down Expand Up @@ -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"
"###
);
});
Expand Down Expand Up @@ -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"
"###
);
});
Expand Down Expand Up @@ -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"
"###
);
});
Expand Down Expand Up @@ -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"
"###
);
});
Expand Down Expand Up @@ -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"
"###
);
});
Expand Down
Loading