Skip to content

Commit 1150de3

Browse files
konstinedmorley
andauthored
uv_build: Allow non-standard entrypoint names (#14867)
It seems that non-standard entrypoints are still widely used, downgrading the error to a tracing warning. Fixes #14442 --------- Co-authored-by: Ed Morley <[email protected]>
1 parent 3b59515 commit 1150de3

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

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

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::str::FromStr;
77

88
use itertools::Itertools;
99
use serde::Deserialize;
10-
use tracing::{debug, trace};
10+
use tracing::{debug, trace, warn};
1111
use version_ranges::Ranges;
1212
use walkdir::WalkDir;
1313

@@ -54,10 +54,6 @@ pub enum ValidationError {
5454
"Entrypoint groups must consist of letters and numbers separated by dots, invalid group: `{0}`"
5555
)]
5656
InvalidGroup(String),
57-
#[error(
58-
"Entrypoint names must consist of letters, numbers, dots, underscores and dashes; invalid name: `{0}`"
59-
)]
60-
InvalidName(String),
6157
#[error("Use `project.scripts` instead of `project.entry-points.console_scripts`")]
6258
ReservedScripts,
6359
#[error("Use `project.gui-scripts` instead of `project.entry-points.gui_scripts`")]
@@ -620,12 +616,14 @@ impl PyProjectToml {
620616

621617
let _ = writeln!(writer, "[{group}]");
622618
for (name, object_reference) in entries {
623-
// More strict than the spec, we enforce the recommendation
624619
if !name
625620
.chars()
626621
.all(|c| c.is_alphanumeric() || c == '.' || c == '-' || c == '_')
627622
{
628-
return Err(ValidationError::InvalidName(name.to_string()));
623+
warn!(
624+
"Entrypoint names should consist of letters, numbers, dots, underscores and \
625+
dashes; non-compliant name: `{name}`"
626+
);
629627
}
630628

631629
// TODO(konsti): Validate that the object references are valid Python identifiers.
@@ -1403,16 +1401,6 @@ mod tests {
14031401
assert_snapshot!(script_error(&contents), @"Entrypoint groups must consist of letters and numbers separated by dots, invalid group: `a@b`");
14041402
}
14051403

1406-
#[test]
1407-
fn invalid_entry_point_name() {
1408-
let contents = extend_project(indoc! {r#"
1409-
[project.scripts]
1410-
"a@b" = "bar"
1411-
"#
1412-
});
1413-
assert_snapshot!(script_error(&contents), @"Entrypoint names must consist of letters, numbers, dots, underscores and dashes; invalid name: `a@b`");
1414-
}
1415-
14161404
#[test]
14171405
fn invalid_entry_point_conflict_scripts() {
14181406
let contents = extend_project(indoc! {r#"

0 commit comments

Comments
 (0)