Skip to content

Commit c0f8e20

Browse files
authored
Allow underscores in entrypoints (#9825)
1 parent 8110ded commit c0f8e20

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/uv-build-backend/src/metadata.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub enum ValidationError {
4040
#[error("Entrypoint groups must consist of letters and numbers separated by dots, invalid group: `{0}`")]
4141
InvalidGroup(String),
4242
#[error(
43-
"Entrypoint names must consist of letters, numbers, dots and dashes; invalid name: `{0}`"
43+
"Entrypoint names must consist of letters, numbers, dots, underscores and dashes; invalid name: `{0}`"
4444
)]
4545
InvalidName(String),
4646
#[error("Use `project.scripts` instead of `project.entry-points.console_scripts`")]
@@ -558,7 +558,7 @@ impl PyProjectToml {
558558
// More strict than the spec, we enforce the recommendation
559559
if !name
560560
.chars()
561-
.all(|c| c.is_alphanumeric() || c == '.' || c == '-')
561+
.all(|c| c.is_alphanumeric() || c == '.' || c == '-' || c == '_')
562562
{
563563
return Err(ValidationError::InvalidName(name.to_string()));
564564
}
@@ -1273,7 +1273,7 @@ mod tests {
12731273
"a@b" = "bar"
12741274
"#
12751275
});
1276-
assert_snapshot!(script_error(&contents), @"Entrypoint names must consist of letters, numbers, dots and dashes; invalid name: `a@b`");
1276+
assert_snapshot!(script_error(&contents), @"Entrypoint names must consist of letters, numbers, dots, underscores and dashes; invalid name: `a@b`");
12771277
}
12781278

12791279
#[test]

0 commit comments

Comments
 (0)