mirror of https://github.com/astral-sh/uv
Allow underscores in entrypoints (#9825)
This commit is contained in:
parent
8110dedde7
commit
c0f8e20a51
|
|
@ -40,7 +40,7 @@ pub enum ValidationError {
|
||||||
#[error("Entrypoint groups must consist of letters and numbers separated by dots, invalid group: `{0}`")]
|
#[error("Entrypoint groups must consist of letters and numbers separated by dots, invalid group: `{0}`")]
|
||||||
InvalidGroup(String),
|
InvalidGroup(String),
|
||||||
#[error(
|
#[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),
|
InvalidName(String),
|
||||||
#[error("Use `project.scripts` instead of `project.entry-points.console_scripts`")]
|
#[error("Use `project.scripts` instead of `project.entry-points.console_scripts`")]
|
||||||
|
|
@ -558,7 +558,7 @@ impl PyProjectToml {
|
||||||
// More strict than the spec, we enforce the recommendation
|
// More strict than the spec, we enforce the recommendation
|
||||||
if !name
|
if !name
|
||||||
.chars()
|
.chars()
|
||||||
.all(|c| c.is_alphanumeric() || c == '.' || c == '-')
|
.all(|c| c.is_alphanumeric() || c == '.' || c == '-' || c == '_')
|
||||||
{
|
{
|
||||||
return Err(ValidationError::InvalidName(name.to_string()));
|
return Err(ValidationError::InvalidName(name.to_string()));
|
||||||
}
|
}
|
||||||
|
|
@ -1273,7 +1273,7 @@ mod tests {
|
||||||
"a@b" = "bar"
|
"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]
|
#[test]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue