Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow dashes and underscores in custom index names #8339

Merged
merged 3 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/uv-distribution-types/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
2 changes: 2 additions & 0 deletions docs/configuration/indexes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading