mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-20 11:56:03 +00:00
Allow dashes and underscores in custom index names (#8339)
Previously, `uv add --index` command threw an error when the index name included characters like hyphens or underscores. Closes #8315
This commit is contained in:
parent
c162078050
commit
69d5e084d5
2 changed files with 6 additions and 1 deletions
|
|
@ -158,7 +158,10 @@ impl FromStr for Index {
|
||||||
return Err(IndexSourceError::EmptyName);
|
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)?;
|
let url = IndexUrl::from_str(url)?;
|
||||||
return Ok(Self {
|
return Ok(Self {
|
||||||
name: Some(name.to_string()),
|
name: Some(name.to_string()),
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ name = "pytorch"
|
||||||
url = "https://download.pytorch.org/whl/cpu"
|
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
|
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
|
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.
|
provided via the command line taking precedence over those in the configuration file.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue