diff --git a/crates/uv-distribution-types/src/index.rs b/crates/uv-distribution-types/src/index.rs index 3e90bacf4..0d04c9a51 100644 --- a/crates/uv-distribution-types/src/index.rs +++ b/crates/uv-distribution-types/src/index.rs @@ -158,7 +158,10 @@ impl FromStr for Index { return Err(IndexSourceError::EmptyName); } - if name.chars().all(char::is_alphanumeric) { + if name + .chars() + .all(|c| c.is_alphanumeric() || c == '-' || c == '_') + { let url = IndexUrl::from_str(url)?; return Ok(Self { name: Some(name.to_string()), diff --git a/docs/configuration/indexes.md b/docs/configuration/indexes.md index 18b6c9d17..a16087eac 100644 --- a/docs/configuration/indexes.md +++ b/docs/configuration/indexes.md @@ -18,6 +18,8 @@ name = "pytorch" url = "https://download.pytorch.org/whl/cpu" ``` +Index names must only contain alphanumeric characters, dashes, or underscores. + Indexes are prioritized in the order in which they’re defined, such that the first index listed in the configuration file is the first index consulted when resolving dependencies, with indexes provided via the command line taking precedence over those in the configuration file.