From 9e549082e851f515c68ce5b568d87cfe4144e5ce Mon Sep 17 00:00:00 2001
From: Charlie Marsh
Date: Mon, 30 Sep 2024 20:47:37 -0400
Subject: [PATCH] Review feedback
---
crates/uv-cli/src/lib.rs | 11 +-
crates/uv-distribution-types/src/index.rs | 2 +-
crates/uv-distribution-types/src/index_url.rs | 8 +-
crates/uv-pypi-types/src/requirement.rs | 2 +-
crates/uv-settings/src/settings.rs | 37 +----
crates/uv-workspace/src/pyproject.rs | 9 +-
crates/uv-workspace/src/workspace.rs | 6 +-
crates/uv/src/settings.rs | 2 +-
crates/uv/tests/it/lock.rs | 156 +++++++++++++++++-
crates/uv/tests/it/show_settings.rs | 14 +-
crates/uv/tests/it/sync.rs | 1 +
docs/concepts/dependencies.md | 2 +-
docs/configuration/environment.md | 14 +-
docs/configuration/indexes.md | 10 +-
docs/reference/cli.md | 120 ++++----------
docs/reference/settings.md | 20 ++-
uv.schema.json | 4 +-
17 files changed, 242 insertions(+), 176 deletions(-)
diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs
index cead8301b662..c173e4cef2e6 100644
--- a/crates/uv-cli/src/lib.rs
+++ b/crates/uv-cli/src/lib.rs
@@ -782,7 +782,6 @@ fn parse_index_url(input: &str) -> Result, String> {
}
}
-
/// Parse a string into an [`FlatIndexLocation`], mapping the empty string to `None`.
fn parse_flat_index(input: &str) -> Result, String> {
if input.is_empty() {
@@ -3861,19 +3860,17 @@ pub struct IndexArgs {
#[arg(long, env = "UV_DEFAULT_INDEX", value_parser = parse_default_index_source, help_heading = "Index options")]
pub default_index: Option>,
- /// The URL of the Python package index (by default: ).
+ /// (Deprecated: use `--default-index` instead) The URL of the Python package index (by default: ).
///
/// Accepts either a repository compliant with PEP 503 (the simple repository API), or a local
/// directory laid out in the same format.
///
/// The index given by this flag is given lower priority than all other
/// indexes specified via the `--extra-index-url` flag.
- ///
- /// (Deprecated: use `--default-index` instead.)
#[arg(long, short, env = EnvVars::UV_INDEX_URL, value_parser = parse_index_url, help_heading = "Index options")]
pub index_url: Option>,
- /// Extra URLs of package indexes to use, in addition to `--index-url`.
+ /// (Deprecated: use `--index` instead) Extra URLs of package indexes to use, in addition to `--index-url`.
///
/// Accepts either a repository compliant with PEP 503 (the simple repository API), or a local
/// directory laid out in the same format.
@@ -3881,9 +3878,7 @@ pub struct IndexArgs {
/// All indexes provided via this flag take priority over the index specified by
/// `--index-url` (which defaults to PyPI). When multiple `--extra-index-url` flags are
/// provided, earlier values take priority.
- ///
- /// (Deprecated: use `--index` instead.)
- #[arg(long, EnvVars::UV_EXTRA_INDEX_URL, value_delimiter = ' ', value_parser = parse_index_url, help_heading = "Index options")]
+ #[arg(long, env = EnvVars::UV_EXTRA_INDEX_URL, value_delimiter = ' ', value_parser = parse_index_url, help_heading = "Index options")]
pub extra_index_url: Option>>,
/// Locations to search for candidate distributions, in addition to those found in the registry
diff --git a/crates/uv-distribution-types/src/index.rs b/crates/uv-distribution-types/src/index.rs
index 4d335a8f7302..baa7d8175730 100644
--- a/crates/uv-distribution-types/src/index.rs
+++ b/crates/uv-distribution-types/src/index.rs
@@ -26,7 +26,7 @@ pub struct Index {
pub url: IndexUrl,
/// Mark the index as explicit.
///
- /// Explicit indexes will _only_ be used when explicitly enabled via a `[tool.uv.sources]`
+ /// Explicit indexes will _only_ be used when explicitly requested via a `[tool.uv.sources]`
/// definition, as in:
///
/// ```toml
diff --git a/crates/uv-distribution-types/src/index_url.rs b/crates/uv-distribution-types/src/index_url.rs
index 6f7b8ad42a22..f868f8c83528 100644
--- a/crates/uv-distribution-types/src/index_url.rs
+++ b/crates/uv-distribution-types/src/index_url.rs
@@ -298,8 +298,8 @@ impl From for FlatIndexLocation {
/// The index locations to use for fetching packages. By default, uses the PyPI index.
///
-/// From a pip perspective, this type merges `--index-url`, `--extra-index-url`, and `--find-links`,
-/// along with the uv-specific `--index` and `--default-index` options.
+/// This type merges the legacy `--index-url`, `--extra-index-url`, and `--find-links` options,
+/// along with the uv-specific `--index` and `--default-index`.
#[derive(Default, Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "kebab-case", deny_unknown_fields)]
pub struct IndexLocations {
@@ -451,8 +451,8 @@ impl<'a> IndexLocations {
/// The index URLs to use for fetching packages.
///
-/// From a pip perspective, this type merges `--index-url` and `--extra-index-url`, along with the
-/// uv-specific `--index` and `--default-index` options.
+/// This type merges the legacy `--index-url` and `--extra-index-url` options, along with the
+/// uv-specific `--index` and `--default-index`.
#[derive(Default, Debug, Clone, PartialEq, Eq)]
pub struct IndexUrls {
indexes: Vec,
diff --git a/crates/uv-pypi-types/src/requirement.rs b/crates/uv-pypi-types/src/requirement.rs
index cfe2feff617e..101b943f36b5 100644
--- a/crates/uv-pypi-types/src/requirement.rs
+++ b/crates/uv-pypi-types/src/requirement.rs
@@ -318,7 +318,7 @@ pub enum RequirementSource {
/// The requirement has a version specifier, such as `foo >1,<2`.
Registry {
specifier: VersionSpecifiers,
- /// Choose a version from the index with this name.
+ /// Choose a version from the index at the given URL.
index: Option,
},
// TODO(konsti): Track and verify version specifier from `project.dependencies` matches the
diff --git a/crates/uv-settings/src/settings.rs b/crates/uv-settings/src/settings.rs
index 62b293a422e4..f2c31fc4d8f2 100644
--- a/crates/uv-settings/src/settings.rs
+++ b/crates/uv-settings/src/settings.rs
@@ -292,7 +292,10 @@ pub struct ResolverInstallerOptions {
/// (the simple repository API), or a local directory laid out in the same format.
///
/// Indexes are considered in the order in which they're defined, such that the first-defined
- /// index has the highest priority.
+ /// index has the highest priority. Further, the indexes provided by this setting are given
+ /// higher priority than any indexes specified via [`index_url`](#index-url) or
+ /// [`extra_index_url`](#extra-index-url). uv will only consider the first index that contains
+ /// a given package, unless an alternative [index strategy](#index-strategy) is specified.
///
/// If an index is marked as `explicit = true`, it will be used exclusively for those
/// dependencies that select it explicitly via `[tool.uv.sources]`, as in:
@@ -307,9 +310,9 @@ pub struct ResolverInstallerOptions {
/// torch = { index = "pytorch" }
/// ```
///
- /// Marking an index as `default = true` will disable the PyPI default index and move the
- /// index to the end of the prioritized list, such that it is used when a package is not found
- /// on any other index.
+ /// If an index is marked as `default = true`, it will be moved to the end of the prioritized list, such that it is
+ /// given the lowest priority when resolving packages. Additionally, marking an index as default will disable the
+ /// PyPI default index.
#[option(
default = "\"[]\"",
value_type = "dict",
@@ -734,32 +737,6 @@ pub struct PipOptions {
"#
)]
pub prefix: Option,
- /// The indexes to use when resolving dependencies.
- ///
- /// Accepts either a repository compliant with [PEP 503](https://peps.python.org/pep-0503/)
- /// (the simple repository API), or a local directory laid out in the same format.
- ///
- /// Indexes are considered in the order in which they're defined, such that the first-defined
- /// index has the highest priority. Further, the indexes provided by this setting are given
- /// higher priority than any indexes specified via [`index_url`](#index-url) or
- /// [`extra_index_url`](#extra-index-url).
- ///
- /// If an index is marked as `explicit = true`, it will be used exclusively for those
- /// dependencies that select it explicitly via `[tool.uv.sources]`, as in:
- ///
- /// ```toml
- /// [[tool.uv.index]]
- /// name = "pytorch"
- /// url = "https://download.pytorch.org/whl/cu121"
- /// explicit = true
- ///
- /// [tool.uv.sources]
- /// torch = { index = "pytorch" }
- /// ```
- ///
- /// If an index is marked as `default = true`, it will be moved to the front of the list of
- /// the list of indexes, such that it is given the highest priority when resolving packages.
- /// Additionally, marking an index as default will disable the PyPI default index.
#[serde(skip)]
#[cfg_attr(feature = "schemars", schemars(skip))]
pub index: Option>,
diff --git a/crates/uv-workspace/src/pyproject.rs b/crates/uv-workspace/src/pyproject.rs
index d397cd6aec98..95bbe4ac1c27 100644
--- a/crates/uv-workspace/src/pyproject.rs
+++ b/crates/uv-workspace/src/pyproject.rs
@@ -163,7 +163,8 @@ pub struct ToolUv {
/// Indexes are considered in the order in which they're defined, such that the first-defined
/// index has the highest priority. Further, the indexes provided by this setting are given
/// higher priority than any indexes specified via [`index_url`](#index-url) or
- /// [`extra_index_url`](#extra-index-url).
+ /// [`extra_index_url`](#extra-index-url). uv will only consider the first index that contains
+ /// a given package, unless an alternative [index strategy](#index-strategy) is specified.
///
/// If an index is marked as `explicit = true`, it will be used exclusively for those
/// dependencies that select it explicitly via `[tool.uv.sources]`, as in:
@@ -178,9 +179,9 @@ pub struct ToolUv {
/// torch = { index = "pytorch" }
/// ```
///
- /// If an index is marked as `default = true`, it will be moved to the front of the list of
- /// the list of indexes, such that it is given the highest priority when resolving packages.
- /// Additionally, marking an index as default will disable the PyPI default index.
+ /// If an index is marked as `default = true`, it will be moved to the end of the prioritized list, such that it is
+ /// given the lowest priority when resolving packages. Additionally, marking an index as default will disable the
+ /// PyPI default index.
#[option(
default = "\"[]\"",
value_type = "dict",
diff --git a/crates/uv-workspace/src/workspace.rs b/crates/uv-workspace/src/workspace.rs
index 16350ee58368..ece22fafa533 100644
--- a/crates/uv-workspace/src/workspace.rs
+++ b/crates/uv-workspace/src/workspace.rs
@@ -1,7 +1,5 @@
//! Resolve the current [`ProjectWorkspace`] or [`Workspace`].
-mod tests;
-
use either::Either;
use glob::{glob, GlobError, PatternError};
use rustc_hash::FxHashSet;
@@ -1524,3 +1522,7 @@ impl<'env> From<&'env VirtualProject> for InstallTarget<'env> {
}
}
}
+
+#[cfg(test)]
+#[cfg(unix)] // Avoid path escaping for the unit tests
+mod tests;
diff --git a/crates/uv/src/settings.rs b/crates/uv/src/settings.rs
index ec246c3436a9..d0d75071c1f8 100644
--- a/crates/uv/src/settings.rs
+++ b/crates/uv/src/settings.rs
@@ -24,8 +24,8 @@ use uv_configuration::{
NoBinary, NoBuild, PreviewMode, Reinstall, SourceStrategy, TargetTriple, TrustedHost,
TrustedPublishing, Upgrade, VersionControlSystem,
};
-use uv_install_wheel::linker::LinkMode;
use uv_distribution_types::{DependencyMetadata, Index, IndexLocations};
+use uv_install_wheel::linker::LinkMode;
use uv_normalize::PackageName;
use uv_pep508::{ExtraName, RequirementOrigin};
use uv_pypi_types::{Requirement, SupportedEnvironments};
diff --git a/crates/uv/tests/it/lock.rs b/crates/uv/tests/it/lock.rs
index 760d9d2306f5..8b76b5c072dd 100644
--- a/crates/uv/tests/it/lock.rs
+++ b/crates/uv/tests/it/lock.rs
@@ -12200,7 +12200,7 @@ fn lock_default_index() -> Result<()> {
}
#[test]
-fn lock_explicit_index_cli() -> Result<()> {
+fn lock_named_index_cli() -> Result<()> {
let context = TestContext::new("3.12");
let pyproject_toml = context.temp_dir.child("pyproject.toml");
@@ -12247,8 +12247,8 @@ fn lock_explicit_index_cli() -> Result<()> {
/// If a name is reused, the higher-priority index should "overwrite" the lower-priority index.
/// In other words, the lower-priority index should be ignored entirely during implicit resolution.
///
-/// In this test, we should use PyPI (the default index) rather than falling back to Test PyPI,
-/// which should be ignored.
+/// In this test, we should use PyPI (the default index) and ignore `https://example.com` entirely.
+/// (Querying `https://example.com` would fail with a 500.)
#[test]
fn lock_repeat_named_index() -> Result<()> {
let context = TestContext::new("3.12");
@@ -12268,10 +12268,11 @@ fn lock_repeat_named_index() -> Result<()> {
[[tool.uv.index]]
name = "pytorch"
- url = "https://test.pypi.org/simple"
+ url = "https://example.com"
"#,
)?;
+ // Fall back to PyPI, since `iniconfig` doesn't exist on the PyTorch index.
uv_snapshot!(context.filters(), context.lock(), @r###"
success: true
exit_code: 0
@@ -12320,6 +12321,153 @@ fn lock_repeat_named_index() -> Result<()> {
Ok(())
}
+/// If a name is reused, the higher-priority index should "overwrite" the lower-priority index.
+/// This includes names passed in via the CLI.
+#[test]
+fn lock_repeat_named_index_cli() -> Result<()> {
+ let context = TestContext::new("3.12");
+
+ let pyproject_toml = context.temp_dir.child("pyproject.toml");
+ pyproject_toml.write_str(
+ r#"
+ [project]
+ name = "project"
+ version = "0.1.0"
+ requires-python = ">=3.12"
+ dependencies = ["jinja2==3.1.2"]
+
+ [[tool.uv.index]]
+ name = "pytorch"
+ url = "https://download.pytorch.org/whl/cu121"
+ "#,
+ )?;
+
+ // Resolve to the PyTorch index.
+ uv_snapshot!(context.filters(), context.lock().env_remove("UV_EXCLUDE_NEWER"), @r###"
+ success: true
+ exit_code: 0
+ ----- stdout -----
+
+ ----- stderr -----
+ Resolved 3 packages in [TIME]
+ "###);
+
+ let lock = fs_err::read_to_string(context.temp_dir.join("uv.lock")).unwrap();
+
+ insta::with_settings!({
+ filters => context.filters(),
+ }, {
+ assert_snapshot!(
+ lock, @r###"
+ version = 1
+ requires-python = ">=3.12"
+
+ [[package]]
+ name = "jinja2"
+ version = "3.1.2"
+ source = { registry = "https://download.pytorch.org/whl/cu121" }
+ dependencies = [
+ { name = "markupsafe" },
+ ]
+ wheels = [
+ { url = "https://download.pytorch.org/whl/Jinja2-3.1.2-py3-none-any.whl", hash = "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61" },
+ ]
+
+ [[package]]
+ name = "markupsafe"
+ version = "2.1.5"
+ source = { registry = "https://download.pytorch.org/whl/cu121" }
+ wheels = [
+ { url = "https://download.pytorch.org/whl/MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:8dec4936e9c3100156f8a2dc89c4b88d5c435175ff03413b443469c7c8c5f4d1" },
+ { url = "https://download.pytorch.org/whl/MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:3c6b973f22eb18a789b1460b4b91bf04ae3f0c4234a0a6aa6b0a92f6f7b951d4" },
+ { url = "https://download.pytorch.org/whl/MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ac07bad82163452a6884fe8fa0963fb98c2346ba78d779ec06bd7a6262132aee" },
+ { url = "https://download.pytorch.org/whl/MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f5dfb42c4604dddc8e4305050aa6deb084540643ed5804d7455b5df8fe16f5e5" },
+ { url = "https://download.pytorch.org/whl/MarkupSafe-2.1.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ea3d8a3d18833cf4304cd2fc9cbb1efe188ca9b5efef2bdac7adc20594a0e46b" },
+ { url = "https://download.pytorch.org/whl/MarkupSafe-2.1.5-cp312-cp312-win_amd64.whl", hash = "sha256:823b65d8706e32ad2df51ed89496147a42a2a6e01c13cfb6ffb8b1e92bc910bb" },
+ ]
+
+ [[package]]
+ name = "project"
+ version = "0.1.0"
+ source = { virtual = "." }
+ dependencies = [
+ { name = "jinja2" },
+ ]
+
+ [package.metadata]
+ requires-dist = [{ name = "jinja2", specifier = "==3.1.2" }]
+ "###
+ );
+ });
+
+ // Resolve to PyPI, since the PyTorch index is replaced by the Packse index, which doesn't
+ // include `jinja2`.
+ uv_snapshot!(context.filters(), context.lock().arg("--index").arg(format!("pytorch={}", packse_index_url())).env_remove("UV_EXCLUDE_NEWER"), @r###"
+ success: true
+ exit_code: 0
+ ----- stdout -----
+
+ ----- stderr -----
+ Resolved 3 packages in [TIME]
+ "###);
+
+ let lock = fs_err::read_to_string(context.temp_dir.join("uv.lock")).unwrap();
+
+ insta::with_settings!({
+ filters => context.filters(),
+ }, {
+ assert_snapshot!(
+ lock, @r###"
+ version = 1
+ requires-python = ">=3.12"
+
+ [[package]]
+ name = "jinja2"
+ version = "3.1.2"
+ source = { registry = "https://pypi.org/simple" }
+ dependencies = [
+ { name = "markupsafe" },
+ ]
+ sdist = { url = "https://files.pythonhosted.org/packages/7a/ff/75c28576a1d900e87eb6335b063fab47a8ef3c8b4d88524c4bf78f670cce/Jinja2-3.1.2.tar.gz", hash = "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852", size = 268239 }
+ wheels = [
+ { url = "https://files.pythonhosted.org/packages/bc/c3/f068337a370801f372f2f8f6bad74a5c140f6fda3d9de154052708dd3c65/Jinja2-3.1.2-py3-none-any.whl", hash = "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61", size = 133101 },
+ ]
+
+ [[package]]
+ name = "markupsafe"
+ version = "2.1.5"
+ source = { registry = "https://pypi.org/simple" }
+ sdist = { url = "https://files.pythonhosted.org/packages/87/5b/aae44c6655f3801e81aa3eef09dbbf012431987ba564d7231722f68df02d/MarkupSafe-2.1.5.tar.gz", hash = "sha256:d283d37a890ba4c1ae73ffadf8046435c76e7bc2247bbb63c00bd1a709c6544b", size = 19384 }
+ wheels = [
+ { url = "https://files.pythonhosted.org/packages/53/bd/583bf3e4c8d6a321938c13f49d44024dbe5ed63e0a7ba127e454a66da974/MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:8dec4936e9c3100156f8a2dc89c4b88d5c435175ff03413b443469c7c8c5f4d1", size = 18215 },
+ { url = "https://files.pythonhosted.org/packages/48/d6/e7cd795fc710292c3af3a06d80868ce4b02bfbbf370b7cee11d282815a2a/MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:3c6b973f22eb18a789b1460b4b91bf04ae3f0c4234a0a6aa6b0a92f6f7b951d4", size = 14069 },
+ { url = "https://files.pythonhosted.org/packages/51/b5/5d8ec796e2a08fc814a2c7d2584b55f889a55cf17dd1a90f2beb70744e5c/MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ac07bad82163452a6884fe8fa0963fb98c2346ba78d779ec06bd7a6262132aee", size = 29452 },
+ { url = "https://files.pythonhosted.org/packages/0a/0d/2454f072fae3b5a137c119abf15465d1771319dfe9e4acbb31722a0fff91/MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f5dfb42c4604dddc8e4305050aa6deb084540643ed5804d7455b5df8fe16f5e5", size = 28462 },
+ { url = "https://files.pythonhosted.org/packages/2d/75/fd6cb2e68780f72d47e6671840ca517bda5ef663d30ada7616b0462ad1e3/MarkupSafe-2.1.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ea3d8a3d18833cf4304cd2fc9cbb1efe188ca9b5efef2bdac7adc20594a0e46b", size = 27869 },
+ { url = "https://files.pythonhosted.org/packages/b0/81/147c477391c2750e8fc7705829f7351cf1cd3be64406edcf900dc633feb2/MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:d050b3361367a06d752db6ead6e7edeb0009be66bc3bae0ee9d97fb326badc2a", size = 33906 },
+ { url = "https://files.pythonhosted.org/packages/8b/ff/9a52b71839d7a256b563e85d11050e307121000dcebc97df120176b3ad93/MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:bec0a414d016ac1a18862a519e54b2fd0fc8bbfd6890376898a6c0891dd82e9f", size = 32296 },
+ { url = "https://files.pythonhosted.org/packages/88/07/2dc76aa51b481eb96a4c3198894f38b480490e834479611a4053fbf08623/MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:58c98fee265677f63a4385256a6d7683ab1832f3ddd1e66fe948d5880c21a169", size = 33038 },
+ { url = "https://files.pythonhosted.org/packages/96/0c/620c1fb3661858c0e37eb3cbffd8c6f732a67cd97296f725789679801b31/MarkupSafe-2.1.5-cp312-cp312-win32.whl", hash = "sha256:8590b4ae07a35970728874632fed7bd57b26b0102df2d2b233b6d9d82f6c62ad", size = 16572 },
+ { url = "https://files.pythonhosted.org/packages/3f/14/c3554d512d5f9100a95e737502f4a2323a1959f6d0d01e0d0997b35f7b10/MarkupSafe-2.1.5-cp312-cp312-win_amd64.whl", hash = "sha256:823b65d8706e32ad2df51ed89496147a42a2a6e01c13cfb6ffb8b1e92bc910bb", size = 17127 },
+ ]
+
+ [[package]]
+ name = "project"
+ version = "0.1.0"
+ source = { virtual = "." }
+ dependencies = [
+ { name = "jinja2" },
+ ]
+
+ [package.metadata]
+ requires-dist = [{ name = "jinja2", specifier = "==3.1.2" }]
+ "###
+ );
+ });
+
+ Ok(())
+}
+
/// Lock a project with `package = false`, making it a virtual project.
#[test]
fn lock_explicit_virtual_project() -> Result<()> {
diff --git a/crates/uv/tests/it/show_settings.rs b/crates/uv/tests/it/show_settings.rs
index fe8d0fa1b96f..295c25fde952 100644
--- a/crates/uv/tests/it/show_settings.rs
+++ b/crates/uv/tests/it/show_settings.rs
@@ -3675,7 +3675,7 @@ fn allow_insecure_host() -> anyhow::Result<()> {
Ok(())
}
-/// Deserialize an insecure host.
+/// Prioritize indexes defined across multiple configuration sources.
#[test]
#[cfg_attr(
windows,
@@ -3714,7 +3714,7 @@ fn index_priority() -> anyhow::Result<()> {
connectivity: Online,
show_settings: true,
preview: Disabled,
- python_preference: OnlySystem,
+ python_preference: Managed,
python_downloads: Automatic,
no_progress: false,
}
@@ -3887,7 +3887,7 @@ fn index_priority() -> anyhow::Result<()> {
connectivity: Online,
show_settings: true,
preview: Disabled,
- python_preference: OnlySystem,
+ python_preference: Managed,
python_downloads: Automatic,
no_progress: false,
}
@@ -4066,7 +4066,7 @@ fn index_priority() -> anyhow::Result<()> {
connectivity: Online,
show_settings: true,
preview: Disabled,
- python_preference: OnlySystem,
+ python_preference: Managed,
python_downloads: Automatic,
no_progress: false,
}
@@ -4240,7 +4240,7 @@ fn index_priority() -> anyhow::Result<()> {
connectivity: Online,
show_settings: true,
preview: Disabled,
- python_preference: OnlySystem,
+ python_preference: Managed,
python_downloads: Automatic,
no_progress: false,
}
@@ -4421,7 +4421,7 @@ fn index_priority() -> anyhow::Result<()> {
connectivity: Online,
show_settings: true,
preview: Disabled,
- python_preference: OnlySystem,
+ python_preference: Managed,
python_downloads: Automatic,
no_progress: false,
}
@@ -4595,7 +4595,7 @@ fn index_priority() -> anyhow::Result<()> {
connectivity: Online,
show_settings: true,
preview: Disabled,
- python_preference: OnlySystem,
+ python_preference: Managed,
python_downloads: Automatic,
no_progress: false,
}
diff --git a/crates/uv/tests/it/sync.rs b/crates/uv/tests/it/sync.rs
index 5bbb5a393cf2..ef264d3aa1b6 100644
--- a/crates/uv/tests/it/sync.rs
+++ b/crates/uv/tests/it/sync.rs
@@ -3126,6 +3126,7 @@ fn sync_explicit() -> Result<()> {
Using CPython 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtual environment at: .venv
Resolved 2 packages in [TIME]
+ Prepared 1 package in [TIME]
Installed 1 package in [TIME]
+ idna==2.7
"###);
diff --git a/docs/concepts/dependencies.md b/docs/concepts/dependencies.md
index 3374105a6c49..e8fa89388bc1 100644
--- a/docs/concepts/dependencies.md
+++ b/docs/concepts/dependencies.md
@@ -70,7 +70,7 @@ standards-compliant `project.dependencies` table.
During development, a project may rely on a package that isn't available on PyPI. The following
additional sources are supported by uv:
-- Index: A package from an explicit package index.
+- Index: A package resolved from a specific package index.
- Git: A Git repository.
- URL: A remote wheel or source distribution.
- Path: A local wheel, source distribution, or project directory.
diff --git a/docs/configuration/environment.md b/docs/configuration/environment.md
index 474d14f924ec..0b20bdaca570 100644
--- a/docs/configuration/environment.md
+++ b/docs/configuration/environment.md
@@ -2,20 +2,18 @@
uv accepts the following command-line arguments as environment variables:
-- `UV_INDEX`: Equivalent to the `--index` command-line argument. If set, uv will use this URL as the
- base index for searching for packages.
+- `UV_INDEX`: Equivalent to the `--index` command-line argument. If set, uv will use this
+ space-separated list of URLs as additional indexes when searching for packages.
- `UV_DEFAULT_INDEX`: Equivalent to the `--default-index` command-line argument. If set, uv will use
- this space-separated list of URLs as additional indexes when searching for packages.
+ this URL as the default index when searching for packages.
- `UV_INDEX_URL`: Equivalent to the `--index-url` command-line argument. If set, uv will use this
- URL as the base index for searching for packages. (Deprecated: use `UV_INDEX` instead.)
+ URL as the default index when searching for packages. (Deprecated: use `UV_DEFAULT_INDEX`
+ instead.)
- `UV_EXTRA_INDEX_URL`: Equivalent to the `--extra-index-url` command-line argument. If set, uv will
use this space-separated list of URLs as additional indexes when searching for packages.
-<<<<<<< HEAD
+ (Deprecated: use `UV_INDEX` instead.)
- `UV_FIND_LINKS`: Equivalent to the `--find-links` command-line argument. If set, uv will use this
comma-separated list of additional locations to search for packages.
-=======
- (Deprecated: use `UV_DEFAULT_INDEX` instead.)
->>>>>>> f9658eca9 (Add explicit index support)
- `UV_CACHE_DIR`: Equivalent to the `--cache-dir` command-line argument. If set, uv will use this
directory for caching instead of the default cache directory.
- `UV_NO_CACHE`: Equivalent to the `--no-cache` command-line argument. If set, uv will not use the
diff --git a/docs/configuration/indexes.md b/docs/configuration/indexes.md
index 70ef968f5f9a..889b5726e632 100644
--- a/docs/configuration/indexes.md
+++ b/docs/configuration/indexes.md
@@ -2,7 +2,7 @@
By default, uv uses the [Python Package Index (PyPI)](https://pypi.org) for dependency resolution
and package installation. However, uv can be configured to use other package indexes, including
-private indexes, via the `[[tool.uv.index]]` configuration option (and `--index`, its analogous
+private indexes, via the `[[tool.uv.index]]` configuration option (and `--index`, the analogous
command-line option).
## Defining an index
@@ -12,9 +12,9 @@ To include an additional index when resolving dependencies, add a `[[tool.uv.ind
```toml
[[tool.uv.index]]
-# Optional, explicit name for the index.
+# Optional name for the index.
name = "pytorch"
-# Required URL for the index. Expects a repository compliant with PEP 503 (the simple repository API).
+# Required URL for the index.
url = "https://download.pytorch.org/whl/cpu"
```
@@ -52,8 +52,8 @@ url = "https://download.pytorch.org/whl/cpu"
```
An index can be marked as `explicit = true` to prevent packages from being installed from that index
-unless explicitly pinned to it. For example, to ensure that `torch` is _only_ installed from the
-`pytorch` index, add the following to your `pyproject.toml`:
+unless explicitly pinned to it. For example, to ensure that `torch` is installed from the `pytorch`
+index, but all other packages are installed from PyPI, add the following to your `pyproject.toml`:
```toml
[tool.uv.sources]
diff --git a/docs/reference/cli.md b/docs/reference/cli.md
index e82086b539f6..0794efbd07f1 100644
--- a/docs/reference/cli.md
+++ b/docs/reference/cli.md
@@ -142,14 +142,12 @@ uv run [OPTIONS] [COMMAND]
This option is only available when running in a project.
---extra-index-url
extra-index-urlExtra URLs of package indexes to use, in addition to --index-url
.
+--extra-index-url
extra-index-url(Deprecated: use --index
instead) Extra URLs of package indexes to use, in addition to --index-url
.
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
All indexes provided via this flag take priority over the index specified by --index-url
(which defaults to PyPI). When multiple --extra-index-url
flags are provided, earlier values take priority.
-(Deprecated: use --index
instead.)
-
May also be set with the UV_EXTRA_INDEX_URL
environment variable.
--find-links
, -f
find-linksLocations to search for candidate distributions, in addition to those found in the registry indexes.
@@ -185,14 +183,12 @@ uv run [OPTIONS] [COMMAND]
unsafe-best-match
: Search for every package name across all indexes, preferring the "best" version found. If a package version is in multiple indexes, only look at the entry for the first index
---index-url
, -i
index-urlThe URL of the Python package index (by default: <https://pypi.org/simple>).
+--index-url
, -i
index-url(Deprecated: use --default-index
instead) The URL of the Python package index (by default: <https://pypi.org/simple>).
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
The index given by this flag is given lower priority than all other indexes specified via the --extra-index-url
flag.
-(Deprecated: use --default-index
instead.)
-
May also be set with the UV_INDEX_URL
environment variable.
--isolated
Run the command in an isolated virtual environment.
@@ -718,14 +714,12 @@ uv add [OPTIONS] >
To add this dependency to an optional group in the current project instead, see --optional
.
---extra-index-url
extra-index-urlExtra URLs of package indexes to use, in addition to --index-url
.
+--extra-index-url
extra-index-url(Deprecated: use --index
instead) Extra URLs of package indexes to use, in addition to --index-url
.
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
All indexes provided via this flag take priority over the index specified by --index-url
(which defaults to PyPI). When multiple --extra-index-url
flags are provided, earlier values take priority.
-(Deprecated: use --index
instead.)
-
May also be set with the UV_EXTRA_INDEX_URL
environment variable.
--find-links
, -f
find-linksLocations to search for candidate distributions, in addition to those found in the registry indexes.
@@ -761,14 +755,12 @@ uv add [OPTIONS] >
unsafe-best-match
: Search for every package name across all indexes, preferring the "best" version found. If a package version is in multiple indexes, only look at the entry for the first index
---index-url
, -i
index-urlThe URL of the Python package index (by default: <https://pypi.org/simple>).
+--index-url
, -i
index-url(Deprecated: use --default-index
instead) The URL of the Python package index (by default: <https://pypi.org/simple>).
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
The index given by this flag is given lower priority than all other indexes specified via the --extra-index-url
flag.
-(Deprecated: use --default-index
instead.)
-
May also be set with the UV_INDEX_URL
environment variable.
--keyring-provider
keyring-providerAttempt to use keyring
for authentication for index URLs.
@@ -1054,14 +1046,12 @@ uv remove [OPTIONS] ...
Accepts both RFC 3339 timestamps (e.g., 2006-12-02T02:07:43Z
) and local dates in the same format (e.g., 2006-12-02
) in your system’s configured time zone.
May also be set with the UV_EXCLUDE_NEWER
environment variable.
---extra-index-url
extra-index-urlExtra URLs of package indexes to use, in addition to --index-url
.
+--extra-index-url
extra-index-url(Deprecated: use --index
instead) Extra URLs of package indexes to use, in addition to --index-url
.
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
All indexes provided via this flag take priority over the index specified by --index-url
(which defaults to PyPI). When multiple --extra-index-url
flags are provided, earlier values take priority.
-(Deprecated: use --index
instead.)
-
May also be set with the UV_EXTRA_INDEX_URL
environment variable.
--find-links
, -f
find-linksLocations to search for candidate distributions, in addition to those found in the registry indexes.
@@ -1097,14 +1087,12 @@ uv remove [OPTIONS] ...
unsafe-best-match
: Search for every package name across all indexes, preferring the "best" version found. If a package version is in multiple indexes, only look at the entry for the first index
---index-url
, -i
index-urlThe URL of the Python package index (by default: <https://pypi.org/simple>).
+--index-url
, -i
index-url(Deprecated: use --default-index
instead) The URL of the Python package index (by default: <https://pypi.org/simple>).
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
The index given by this flag is given lower priority than all other indexes specified via the --extra-index-url
flag.
-(Deprecated: use --default-index
instead.)
-
May also be set with the UV_INDEX_URL
environment variable.
--keyring-provider
keyring-providerAttempt to use keyring
for authentication for index URLs.
@@ -1378,14 +1366,12 @@ uv sync [OPTIONS]
Note that all optional dependencies are always included in the resolution; this option only affects the selection of packages to install.
---extra-index-url
extra-index-urlExtra URLs of package indexes to use, in addition to --index-url
.
+--extra-index-url
extra-index-url(Deprecated: use --index
instead) Extra URLs of package indexes to use, in addition to --index-url
.
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
All indexes provided via this flag take priority over the index specified by --index-url
(which defaults to PyPI). When multiple --extra-index-url
flags are provided, earlier values take priority.
-(Deprecated: use --index
instead.)
-
May also be set with the UV_EXTRA_INDEX_URL
environment variable.
--find-links
, -f
find-linksLocations to search for candidate distributions, in addition to those found in the registry indexes.
@@ -1421,14 +1407,12 @@ uv sync [OPTIONS]
unsafe-best-match
: Search for every package name across all indexes, preferring the "best" version found. If a package version is in multiple indexes, only look at the entry for the first index
---index-url
, -i
index-urlThe URL of the Python package index (by default: <https://pypi.org/simple>).
+--index-url
, -i
index-url(Deprecated: use --default-index
instead) The URL of the Python package index (by default: <https://pypi.org/simple>).
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
The index given by this flag is given lower priority than all other indexes specified via the --extra-index-url
flag.
-(Deprecated: use --default-index
instead.)
-
May also be set with the UV_INDEX_URL
environment variable.
--inexact
Do not remove extraneous packages present in the environment.
@@ -1700,14 +1684,12 @@ uv lock [OPTIONS]
Accepts both RFC 3339 timestamps (e.g., 2006-12-02T02:07:43Z
) and local dates in the same format (e.g., 2006-12-02
) in your system’s configured time zone.
May also be set with the UV_EXCLUDE_NEWER
environment variable.
---extra-index-url
extra-index-urlExtra URLs of package indexes to use, in addition to --index-url
.
+--extra-index-url
extra-index-url(Deprecated: use --index
instead) Extra URLs of package indexes to use, in addition to --index-url
.
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
All indexes provided via this flag take priority over the index specified by --index-url
(which defaults to PyPI). When multiple --extra-index-url
flags are provided, earlier values take priority.
-(Deprecated: use --index
instead.)
-
May also be set with the UV_EXTRA_INDEX_URL
environment variable.
--find-links
, -f
find-linksLocations to search for candidate distributions, in addition to those found in the registry indexes.
@@ -1741,14 +1723,12 @@ uv lock [OPTIONS]
unsafe-best-match
: Search for every package name across all indexes, preferring the "best" version found. If a package version is in multiple indexes, only look at the entry for the first index
---index-url
, -i
index-urlThe URL of the Python package index (by default: <https://pypi.org/simple>).
+--index-url
, -i
index-url(Deprecated: use --default-index
instead) The URL of the Python package index (by default: <https://pypi.org/simple>).
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
The index given by this flag is given lower priority than all other indexes specified via the --extra-index-url
flag.
-(Deprecated: use --default-index
instead.)
-
May also be set with the UV_INDEX_URL
environment variable.
--keyring-provider
keyring-providerAttempt to use keyring
for authentication for index URLs.
@@ -1998,14 +1978,12 @@ uv export [OPTIONS]
May be provided more than once.
---extra-index-url
extra-index-urlExtra URLs of package indexes to use, in addition to --index-url
.
+--extra-index-url
extra-index-url(Deprecated: use --index
instead) Extra URLs of package indexes to use, in addition to --index-url
.
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
All indexes provided via this flag take priority over the index specified by --index-url
(which defaults to PyPI). When multiple --extra-index-url
flags are provided, earlier values take priority.
-(Deprecated: use --index
instead.)
-
May also be set with the UV_EXTRA_INDEX_URL
environment variable.
--find-links
, -f
find-linksLocations to search for candidate distributions, in addition to those found in the registry indexes.
@@ -2051,14 +2029,12 @@ uv export [OPTIONS]
unsafe-best-match
: Search for every package name across all indexes, preferring the "best" version found. If a package version is in multiple indexes, only look at the entry for the first index
---index-url
, -i
index-urlThe URL of the Python package index (by default: <https://pypi.org/simple>).
+--index-url
, -i
index-url(Deprecated: use --default-index
instead) The URL of the Python package index (by default: <https://pypi.org/simple>).
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
The index given by this flag is given lower priority than all other indexes specified via the --extra-index-url
flag.
-(Deprecated: use --default-index
instead.)
-
May also be set with the UV_INDEX_URL
environment variable.
--keyring-provider
keyring-providerAttempt to use keyring
for authentication for index URLs.
@@ -2327,14 +2303,12 @@ uv tree [OPTIONS]
Accepts both RFC 3339 timestamps (e.g., 2006-12-02T02:07:43Z
) and local dates in the same format (e.g., 2006-12-02
) in your system’s configured time zone.
May also be set with the UV_EXCLUDE_NEWER
environment variable.
---extra-index-url
extra-index-urlExtra URLs of package indexes to use, in addition to --index-url
.
+--extra-index-url
extra-index-url(Deprecated: use --index
instead) Extra URLs of package indexes to use, in addition to --index-url
.
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
All indexes provided via this flag take priority over the index specified by --index-url
(which defaults to PyPI). When multiple --extra-index-url
flags are provided, earlier values take priority.
-(Deprecated: use --index
instead.)
-
May also be set with the UV_EXTRA_INDEX_URL
environment variable.
--find-links
, -f
find-linksLocations to search for candidate distributions, in addition to those found in the registry indexes.
@@ -2370,14 +2344,12 @@ uv tree [OPTIONS]
unsafe-best-match
: Search for every package name across all indexes, preferring the "best" version found. If a package version is in multiple indexes, only look at the entry for the first index
---index-url
, -i
index-urlThe URL of the Python package index (by default: <https://pypi.org/simple>).
+--index-url
, -i
index-url(Deprecated: use --default-index
instead) The URL of the Python package index (by default: <https://pypi.org/simple>).
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
The index given by this flag is given lower priority than all other indexes specified via the --extra-index-url
flag.
-(Deprecated: use --default-index
instead.)
-
May also be set with the UV_INDEX_URL
environment variable.
--invert
Show the reverse dependencies for the given package. This flag will invert the tree and display the packages that depend on the given package
@@ -2719,14 +2691,12 @@ uv tool run [OPTIONS] [COMMAND]
Accepts both RFC 3339 timestamps (e.g., 2006-12-02T02:07:43Z
) and local dates in the same format (e.g., 2006-12-02
) in your system’s configured time zone.
May also be set with the UV_EXCLUDE_NEWER
environment variable.
---extra-index-url
extra-index-urlExtra URLs of package indexes to use, in addition to --index-url
.
+--extra-index-url
extra-index-url(Deprecated: use --index
instead) Extra URLs of package indexes to use, in addition to --index-url
.
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
All indexes provided via this flag take priority over the index specified by --index-url
(which defaults to PyPI). When multiple --extra-index-url
flags are provided, earlier values take priority.
-(Deprecated: use --index
instead.)
-
May also be set with the UV_EXTRA_INDEX_URL
environment variable.
--find-links
, -f
find-linksLocations to search for candidate distributions, in addition to those found in the registry indexes.
@@ -2762,14 +2732,12 @@ uv tool run [OPTIONS] [COMMAND]
unsafe-best-match
: Search for every package name across all indexes, preferring the "best" version found. If a package version is in multiple indexes, only look at the entry for the first index
---index-url
, -i
index-urlThe URL of the Python package index (by default: <https://pypi.org/simple>).
+--index-url
, -i
index-url(Deprecated: use --default-index
instead) The URL of the Python package index (by default: <https://pypi.org/simple>).
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
The index given by this flag is given lower priority than all other indexes specified via the --extra-index-url
flag.
-(Deprecated: use --default-index
instead.)
-
May also be set with the UV_INDEX_URL
environment variable.
--isolated
Run the tool in an isolated virtual environment, ignoring any already-installed tools
@@ -3026,14 +2994,12 @@ uv tool install [OPTIONS]
Accepts both RFC 3339 timestamps (e.g., 2006-12-02T02:07:43Z
) and local dates in the same format (e.g., 2006-12-02
) in your system’s configured time zone.
May also be set with the UV_EXCLUDE_NEWER
environment variable.
---extra-index-url
extra-index-urlExtra URLs of package indexes to use, in addition to --index-url
.
+--extra-index-url
extra-index-url(Deprecated: use --index
instead) Extra URLs of package indexes to use, in addition to --index-url
.
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
All indexes provided via this flag take priority over the index specified by --index-url
(which defaults to PyPI). When multiple --extra-index-url
flags are provided, earlier values take priority.
-(Deprecated: use --index
instead.)
-
May also be set with the UV_EXTRA_INDEX_URL
environment variable.
--find-links
, -f
find-linksLocations to search for candidate distributions, in addition to those found in the registry indexes.
@@ -3069,14 +3035,12 @@ uv tool install [OPTIONS]
unsafe-best-match
: Search for every package name across all indexes, preferring the "best" version found. If a package version is in multiple indexes, only look at the entry for the first index
---index-url
, -i
index-urlThe URL of the Python package index (by default: <https://pypi.org/simple>).
+--index-url
, -i
index-url(Deprecated: use --default-index
instead) The URL of the Python package index (by default: <https://pypi.org/simple>).
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
The index given by this flag is given lower priority than all other indexes specified via the --extra-index-url
flag.
-(Deprecated: use --default-index
instead.)
-
May also be set with the UV_INDEX_URL
environment variable.
--keyring-provider
keyring-providerAttempt to use keyring
for authentication for index URLs.
@@ -3329,14 +3293,12 @@ uv tool upgrade [OPTIONS] ...
Accepts both RFC 3339 timestamps (e.g., 2006-12-02T02:07:43Z
) and local dates in the same format (e.g., 2006-12-02
) in your system’s configured time zone.
May also be set with the UV_EXCLUDE_NEWER
environment variable.
---extra-index-url
extra-index-urlExtra URLs of package indexes to use, in addition to --index-url
.
+--extra-index-url
extra-index-url(Deprecated: use --index
instead) Extra URLs of package indexes to use, in addition to --index-url
.
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
All indexes provided via this flag take priority over the index specified by --index-url
(which defaults to PyPI). When multiple --extra-index-url
flags are provided, earlier values take priority.
-(Deprecated: use --index
instead.)
-
May also be set with the UV_EXTRA_INDEX_URL
environment variable.
--find-links
, -f
find-linksLocations to search for candidate distributions, in addition to those found in the registry indexes.
@@ -3368,14 +3330,12 @@ uv tool upgrade [OPTIONS] ...
unsafe-best-match
: Search for every package name across all indexes, preferring the "best" version found. If a package version is in multiple indexes, only look at the entry for the first index
---index-url
, -i
index-urlThe URL of the Python package index (by default: <https://pypi.org/simple>).
+--index-url
, -i
index-url(Deprecated: use --default-index
instead) The URL of the Python package index (by default: <https://pypi.org/simple>).
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
The index given by this flag is given lower priority than all other indexes specified via the --extra-index-url
flag.
-(Deprecated: use --default-index
instead.)
-
May also be set with the UV_INDEX_URL
environment variable.
--keyring-provider
keyring-providerAttempt to use keyring
for authentication for index URLs.
@@ -4912,14 +4872,12 @@ uv pip compile [OPTIONS] ...
Only applies to pyproject.toml
, setup.py
, and setup.cfg
sources.
---extra-index-url
extra-index-urlExtra URLs of package indexes to use, in addition to --index-url
.
+--extra-index-url
extra-index-url(Deprecated: use --index
instead) Extra URLs of package indexes to use, in addition to --index-url
.
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
All indexes provided via this flag take priority over the index specified by --index-url
(which defaults to PyPI). When multiple --extra-index-url
flags are provided, earlier values take priority.
-(Deprecated: use --index
instead.)
-
May also be set with the UV_EXTRA_INDEX_URL
environment variable.
--find-links
, -f
find-linksLocations to search for candidate distributions, in addition to those found in the registry indexes.
@@ -4953,14 +4911,12 @@ uv pip compile [OPTIONS] ...
unsafe-best-match
: Search for every package name across all indexes, preferring the "best" version found. If a package version is in multiple indexes, only look at the entry for the first index
---index-url
, -i
index-urlThe URL of the Python package index (by default: <https://pypi.org/simple>).
+--index-url
, -i
index-url(Deprecated: use --default-index
instead) The URL of the Python package index (by default: <https://pypi.org/simple>).
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
The index given by this flag is given lower priority than all other indexes specified via the --extra-index-url
flag.
-(Deprecated: use --default-index
instead.)
-
May also be set with the UV_INDEX_URL
environment variable.
--keyring-provider
keyring-providerAttempt to use keyring
for authentication for index URLs.
@@ -5319,14 +5275,12 @@ uv pip sync [OPTIONS] ...
Accepts both RFC 3339 timestamps (e.g., 2006-12-02T02:07:43Z
) and local dates in the same format (e.g., 2006-12-02
) in your system’s configured time zone.
May also be set with the UV_EXCLUDE_NEWER
environment variable.
---extra-index-url
extra-index-urlExtra URLs of package indexes to use, in addition to --index-url
.
+--extra-index-url
extra-index-url(Deprecated: use --index
instead) Extra URLs of package indexes to use, in addition to --index-url
.
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
All indexes provided via this flag take priority over the index specified by --index-url
(which defaults to PyPI). When multiple --extra-index-url
flags are provided, earlier values take priority.
-(Deprecated: use --index
instead.)
-
May also be set with the UV_EXTRA_INDEX_URL
environment variable.
--find-links
, -f
find-linksLocations to search for candidate distributions, in addition to those found in the registry indexes.
@@ -5358,14 +5312,12 @@ uv pip sync [OPTIONS] ...
unsafe-best-match
: Search for every package name across all indexes, preferring the "best" version found. If a package version is in multiple indexes, only look at the entry for the first index
---index-url
, -i
index-urlThe URL of the Python package index (by default: <https://pypi.org/simple>).
+--index-url
, -i
index-url(Deprecated: use --default-index
instead) The URL of the Python package index (by default: <https://pypi.org/simple>).
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
The index given by this flag is given lower priority than all other indexes specified via the --extra-index-url
flag.
-(Deprecated: use --default-index
instead.)
-
May also be set with the UV_INDEX_URL
environment variable.
--keyring-provider
keyring-providerAttempt to use keyring
for authentication for index URLs.
@@ -5684,14 +5636,12 @@ uv pip install [OPTIONS] |--editable Only applies to pyproject.toml
, setup.py
, and setup.cfg
sources.
---extra-index-url
extra-index-urlExtra URLs of package indexes to use, in addition to --index-url
.
+--extra-index-url
extra-index-url(Deprecated: use --index
instead) Extra URLs of package indexes to use, in addition to --index-url
.
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
All indexes provided via this flag take priority over the index specified by --index-url
(which defaults to PyPI). When multiple --extra-index-url
flags are provided, earlier values take priority.
-(Deprecated: use --index
instead.)
-
May also be set with the UV_EXTRA_INDEX_URL
environment variable.
--find-links
, -f
find-linksLocations to search for candidate distributions, in addition to those found in the registry indexes.
@@ -5723,14 +5673,12 @@ uv pip install [OPTIONS] |--editable unsafe-best-match
: Search for every package name across all indexes, preferring the "best" version found. If a package version is in multiple indexes, only look at the entry for the first index
---index-url
, -i
index-urlThe URL of the Python package index (by default: <https://pypi.org/simple>).
+--index-url
, -i
index-url(Deprecated: use --default-index
instead) The URL of the Python package index (by default: <https://pypi.org/simple>).
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
The index given by this flag is given lower priority than all other indexes specified via the --extra-index-url
flag.
-(Deprecated: use --default-index
instead.)
-
May also be set with the UV_INDEX_URL
environment variable.
--keyring-provider
keyring-providerAttempt to use keyring
for authentication for index URLs.
@@ -6872,14 +6820,12 @@ uv venv [OPTIONS] [PATH]
Accepts both RFC 3339 timestamps (e.g., 2006-12-02T02:07:43Z
) and local dates in the same format (e.g., 2006-12-02
) in your system’s configured time zone.
May also be set with the UV_EXCLUDE_NEWER
environment variable.
---extra-index-url
extra-index-urlExtra URLs of package indexes to use, in addition to --index-url
.
+--extra-index-url
extra-index-url(Deprecated: use --index
instead) Extra URLs of package indexes to use, in addition to --index-url
.
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
All indexes provided via this flag take priority over the index specified by --index-url
(which defaults to PyPI). When multiple --extra-index-url
flags are provided, earlier values take priority.
-(Deprecated: use --index
instead.)
-
May also be set with the UV_EXTRA_INDEX_URL
environment variable.
--find-links
, -f
find-linksLocations to search for candidate distributions, in addition to those found in the registry indexes.
@@ -6911,14 +6857,12 @@ uv venv [OPTIONS] [PATH]
unsafe-best-match
: Search for every package name across all indexes, preferring the "best" version found. If a package version is in multiple indexes, only look at the entry for the first index
---index-url
, -i
index-urlThe URL of the Python package index (by default: <https://pypi.org/simple>).
+--index-url
, -i
index-url(Deprecated: use --default-index
instead) The URL of the Python package index (by default: <https://pypi.org/simple>).
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
The index given by this flag is given lower priority than all other indexes specified via the --extra-index-url
flag.
-(Deprecated: use --default-index
instead.)
-
May also be set with the UV_INDEX_URL
environment variable.
--keyring-provider
keyring-providerAttempt to use keyring
for authentication for index URLs.
@@ -7138,14 +7082,12 @@ uv build [OPTIONS] [SRC]
Accepts both RFC 3339 timestamps (e.g., 2006-12-02T02:07:43Z
) and local dates in the same format (e.g., 2006-12-02
) in your system’s configured time zone.
May also be set with the UV_EXCLUDE_NEWER
environment variable.
---extra-index-url
extra-index-urlExtra URLs of package indexes to use, in addition to --index-url
.
+--extra-index-url
extra-index-url(Deprecated: use --index
instead) Extra URLs of package indexes to use, in addition to --index-url
.
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
All indexes provided via this flag take priority over the index specified by --index-url
(which defaults to PyPI). When multiple --extra-index-url
flags are provided, earlier values take priority.
-(Deprecated: use --index
instead.)
-
May also be set with the UV_EXTRA_INDEX_URL
environment variable.
--find-links
, -f
find-linksLocations to search for candidate distributions, in addition to those found in the registry indexes.
@@ -7177,14 +7119,12 @@ uv build [OPTIONS] [SRC]
unsafe-best-match
: Search for every package name across all indexes, preferring the "best" version found. If a package version is in multiple indexes, only look at the entry for the first index
---index-url
, -i
index-urlThe URL of the Python package index (by default: <https://pypi.org/simple>).
+--index-url
, -i
index-url(Deprecated: use --default-index
instead) The URL of the Python package index (by default: <https://pypi.org/simple>).
Accepts either a repository compliant with PEP 503 (the simple repository API), or a local directory laid out in the same format.
The index given by this flag is given lower priority than all other indexes specified via the --extra-index-url
flag.
-(Deprecated: use --default-index
instead.)
-
May also be set with the UV_INDEX_URL
environment variable.
--keyring-provider
keyring-providerAttempt to use keyring
for authentication for index URLs.
diff --git a/docs/reference/settings.md b/docs/reference/settings.md
index 03e7dd2c3c8a..ff89d4e8be8f 100644
--- a/docs/reference/settings.md
+++ b/docs/reference/settings.md
@@ -83,7 +83,8 @@ Accepts either a repository compliant with [PEP 503](https://peps.python.org/pep
Indexes are considered in the order in which they're defined, such that the first-defined
index has the highest priority. Further, the indexes provided by this setting are given
higher priority than any indexes specified via [`index_url`](#index-url) or
-[`extra_index_url`](#extra-index-url).
+[`extra_index_url`](#extra-index-url). uv will only consider the first index that contains
+a given package, unless an alternative [index strategy](#index-strategy) is specified.
If an index is marked as `explicit = true`, it will be used exclusively for those
dependencies that select it explicitly via `[tool.uv.sources]`, as in:
@@ -98,9 +99,9 @@ explicit = true
torch = { index = "pytorch" }
```
-If an index is marked as `default = true`, it will be moved to the front of the list of
-the list of indexes, such that it is given the highest priority when resolving packages.
-Additionally, marking an index as default will disable the PyPI default index.
+If an index is marked as `default = true`, it will be moved to the end of the prioritized list, such that it is
+given the lowest priority when resolving packages. Additionally, marking an index as default will disable the
+PyPI default index.
**Default value**: `"[]"`
@@ -646,7 +647,10 @@ Accepts either a repository compliant with [PEP 503](https://peps.python.org/pep
(the simple repository API), or a local directory laid out in the same format.
Indexes are considered in the order in which they're defined, such that the first-defined
-index has the highest priority.
+index has the highest priority. Further, the indexes provided by this setting are given
+higher priority than any indexes specified via [`index_url`](#index-url) or
+[`extra_index_url`](#extra-index-url). uv will only consider the first index that contains
+a given package, unless an alternative [index strategy](#index-strategy) is specified.
If an index is marked as `explicit = true`, it will be used exclusively for those
dependencies that select it explicitly via `[tool.uv.sources]`, as in:
@@ -661,9 +665,9 @@ explicit = true
torch = { index = "pytorch" }
```
-Marking an index as `default = true` will disable the PyPI default index and move the
-index to the end of the prioritized list, such that it is used when a package is not found
-on any other index.
+If an index is marked as `default = true`, it will be moved to the end of the prioritized list, such that it is
+given the lowest priority when resolving packages. Additionally, marking an index as default will disable the
+PyPI default index.
**Default value**: `"[]"`
diff --git a/uv.schema.json b/uv.schema.json
index b15d0f1c9187..f6ab2f8c57b4 100644
--- a/uv.schema.json
+++ b/uv.schema.json
@@ -148,7 +148,7 @@
}
},
"index": {
- "description": "The indexes to use when resolving dependencies.\n\nAccepts either a repository compliant with [PEP 503](https://peps.python.org/pep-0503/) (the simple repository API), or a local directory laid out in the same format.\n\nIndexes are considered in the order in which they're defined, such that the first-defined index has the highest priority. Further, the indexes provided by this setting are given higher priority than any indexes specified via [`index_url`](#index-url) or [`extra_index_url`](#extra-index-url).\n\nIf an index is marked as `explicit = true`, it will be used exclusively for those dependencies that select it explicitly via `[tool.uv.sources]`, as in:\n\n```toml [[tool.uv.index]] name = \"pytorch\" url = \"https://download.pytorch.org/whl/cu121\" explicit = true\n\n[tool.uv.sources] torch = { index = \"pytorch\" } ```\n\nIf an index is marked as `default = true`, it will be moved to the front of the list of the list of indexes, such that it is given the highest priority when resolving packages. Additionally, marking an index as default will disable the PyPI default index.",
+ "description": "The indexes to use when resolving dependencies.\n\nAccepts either a repository compliant with [PEP 503](https://peps.python.org/pep-0503/) (the simple repository API), or a local directory laid out in the same format.\n\nIndexes are considered in the order in which they're defined, such that the first-defined index has the highest priority. Further, the indexes provided by this setting are given higher priority than any indexes specified via [`index_url`](#index-url) or [`extra_index_url`](#extra-index-url). uv will only consider the first index that contains a given package, unless an alternative [index strategy](#index-strategy) is specified.\n\nIf an index is marked as `explicit = true`, it will be used exclusively for those dependencies that select it explicitly via `[tool.uv.sources]`, as in:\n\n```toml [[tool.uv.index]] name = \"pytorch\" url = \"https://download.pytorch.org/whl/cu121\" explicit = true\n\n[tool.uv.sources] torch = { index = \"pytorch\" } ```\n\nIf an index is marked as `default = true`, it will be moved to the end of the prioritized list, such that it is given the lowest priority when resolving packages. Additionally, marking an index as default will disable the PyPI default index.",
"type": [
"array",
"null"
@@ -567,7 +567,7 @@
"type": "boolean"
},
"explicit": {
- "description": "Mark the index as explicit.\n\nExplicit indexes will _only_ be used when explicitly enabled via a `[tool.uv.sources]` definition, as in:\n\n```toml [[tool.uv.index]] name = \"pytorch\" url = \"https://download.pytorch.org/whl/cu121\" explicit = true\n\n[tool.uv.sources] torch = { index = \"pytorch\" } ```",
+ "description": "Mark the index as explicit.\n\nExplicit indexes will _only_ be used when explicitly requested via a `[tool.uv.sources]` definition, as in:\n\n```toml [[tool.uv.index]] name = \"pytorch\" url = \"https://download.pytorch.org/whl/cu121\" explicit = true\n\n[tool.uv.sources] torch = { index = \"pytorch\" } ```",
"default": false,
"type": "boolean"
},