Skip to content

Commit

Permalink
Allow underscores in entrypoints (#9825)
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin authored Dec 11, 2024
1 parent 8110ded commit c0f8e20
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/uv-build-backend/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub enum ValidationError {
#[error("Entrypoint groups must consist of letters and numbers separated by dots, invalid group: `{0}`")]
InvalidGroup(String),
#[error(
"Entrypoint names must consist of letters, numbers, dots and dashes; invalid name: `{0}`"
"Entrypoint names must consist of letters, numbers, dots, underscores and dashes; invalid name: `{0}`"
)]
InvalidName(String),
#[error("Use `project.scripts` instead of `project.entry-points.console_scripts`")]
Expand Down Expand Up @@ -558,7 +558,7 @@ impl PyProjectToml {
// More strict than the spec, we enforce the recommendation
if !name
.chars()
.all(|c| c.is_alphanumeric() || c == '.' || c == '-')
.all(|c| c.is_alphanumeric() || c == '.' || c == '-' || c == '_')
{
return Err(ValidationError::InvalidName(name.to_string()));
}
Expand Down Expand Up @@ -1273,7 +1273,7 @@ mod tests {
"a@b" = "bar"
"#
});
assert_snapshot!(script_error(&contents), @"Entrypoint names must consist of letters, numbers, dots and dashes; invalid name: `a@b`");
assert_snapshot!(script_error(&contents), @"Entrypoint names must consist of letters, numbers, dots, underscores and dashes; invalid name: `a@b`");
}

#[test]
Expand Down

0 comments on commit c0f8e20

Please sign in to comment.