diff --git a/Cargo.lock b/Cargo.lock
index 3c3c9895d..03a6338ca 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1053,6 +1053,35 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d7439c3735f405729d52c3fbbe4de140eaf938a1fe47d227c27f8254d4302a5"
+[[package]]
+name = "dbus"
+version = "0.9.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1bb21987b9fb1613058ba3843121dd18b163b254d8a6e797e144cbac14d96d1b"
+dependencies = [
+ "libc",
+ "libdbus-sys",
+ "winapi",
+]
+
+[[package]]
+name = "dbus-secret-service"
+version = "4.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b42a16374481d92aed73ae45b1f120207d8e71d24fb89f357fadbd8f946fd84b"
+dependencies = [
+ "aes",
+ "block-padding",
+ "cbc",
+ "dbus",
+ "futures-util",
+ "hkdf",
+ "num",
+ "once_cell",
+ "rand",
+ "sha2",
+]
+
[[package]]
name = "deadpool"
version = "0.10.0"
@@ -2218,6 +2247,19 @@ dependencies = [
"windows-sys 0.52.0",
]
+[[package]]
+name = "keyring"
+version = "4.0.0-rc.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb06f73ca0ea1cbd3858e54404585e33dccb860cb4fc8a66ad5e75a5736f3f19"
+dependencies = [
+ "byteorder",
+ "dbus-secret-service",
+ "log",
+ "security-framework",
+ "windows-sys 0.59.0",
+]
+
[[package]]
name = "kurbo"
version = "0.8.3"
@@ -2248,6 +2290,15 @@ version = "0.2.175"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
+[[package]]
+name = "libdbus-sys"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06085512b750d640299b79be4bad3d2fa90a9c00b1fd9e1b46364f66f0485c72"
+dependencies = [
+ "pkg-config",
+]
+
[[package]]
name = "libmimalloc-sys"
version = "0.1.43"
@@ -5108,6 +5159,7 @@ dependencies = [
"futures",
"http",
"insta",
+ "keyring",
"percent-encoding",
"reqwest",
"reqwest-middleware",
diff --git a/Cargo.toml b/Cargo.toml
index 41f8b5d65..ca1b23b1e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -125,6 +125,7 @@ indoc = { version = "2.0.5" }
itertools = { version = "0.14.0" }
jiff = { version = "0.2.0", features = ["serde"] }
junction = { version = "1.2.0" }
+keyring = { version = "4.0.0-rc.1", features = ["encrypted"] }
mailparse = { version = "0.16.0" }
md-5 = { version = "0.10.6" }
memchr = { version = "2.7.4" }
diff --git a/crates/uv-auth/Cargo.toml b/crates/uv-auth/Cargo.toml
index cbe4d4787..1e93a4aec 100644
--- a/crates/uv-auth/Cargo.toml
+++ b/crates/uv-auth/Cargo.toml
@@ -21,6 +21,7 @@ async-trait = { workspace = true }
base64 = { workspace = true }
futures = { workspace = true }
http = { workspace = true }
+keyring = { workspace = true }
percent-encoding = { workspace = true }
reqwest = { workspace = true }
reqwest-middleware = { workspace = true }
diff --git a/crates/uv-auth/src/keyring.rs b/crates/uv-auth/src/keyring.rs
index 41b92114a..779ab2823 100644
--- a/crates/uv-auth/src/keyring.rs
+++ b/crates/uv-auth/src/keyring.rs
@@ -1,11 +1,21 @@
-use std::{io::Write, process::Stdio};
+use rustc_hash::FxHashSet;
+use std::{
+ io::Write,
+ process::Stdio,
+ sync::{LazyLock, RwLock},
+};
use tokio::process::Command;
-use tracing::{instrument, trace, warn};
+use tracing::{debug, instrument, trace, warn};
use uv_redacted::DisplaySafeUrl;
use uv_warnings::warn_user_once;
use crate::credentials::Credentials;
+/// Keyring credentials that have been stored during an invocation of uv.
+static STORED_KEYRING_URLS: LazyLock May also be set with the Possible values: The method to use when installing packages from the global cache. Defaults to May also be set with the Possible values: The method to use when installing packages from the global cache. Defaults to May also be set with the Possible values: The method to use when installing packages from the global cache. Defaults to May also be set with the Possible values: The method to use when installing packages from the global cache. Defaults to May also be set with the Possible values: The method to use when installing packages from the global cache. Defaults to May also be set with the Possible values: The method to use when installing packages from the global cache. This option is only used when building source distributions. May also be set with the Possible values: The method to use when installing packages from the global cache. This option is only used when building source distributions. May also be set with the Possible values: The method to use when installing packages from the global cache. This option is only used when building source distributions. May also be set with the Possible values: The method to use when installing packages from the global cache. Defaults to May also be set with the Possible values: The method to use when installing packages from the global cache. Defaults to May also be set with the Possible values: The method to use when installing packages from the global cache. Defaults to May also be set with the Possible values: The method to use when installing packages from the global cache. This option is only used when building source distributions. May also be set with the Possible values: The method to use when installing packages from the global cache. Defaults to UV_KEYRING_PROVIDER environment variable.
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--link-mode link-modeclone (also known as Copy-on-Write) on macOS, and hardlink on Linux and Windows.UV_KEYRING_PROVIDER environment variable.
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--link-mode link-modeclone (also known as Copy-on-Write) on macOS, and hardlink on Linux and Windows.UV_KEYRING_PROVIDER environment variable.
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--link-mode link-modeclone (also known as Copy-on-Write) on macOS, and hardlink on Linux and Windows.UV_KEYRING_PROVIDER environment variable.
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--link-mode link-modeclone (also known as Copy-on-Write) on macOS, and hardlink on Linux and Windows.UV_KEYRING_PROVIDER environment variable.
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--link-mode link-modeclone (also known as Copy-on-Write) on macOS, and hardlink on Linux and Windows.UV_KEYRING_PROVIDER environment variable.
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--link-mode link-modeUV_KEYRING_PROVIDER environment variable.
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--link-mode link-modeUV_KEYRING_PROVIDER environment variable.
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--link-mode link-modeUV_KEYRING_PROVIDER environment variable.
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--link-mode link-modeclone (also known as Copy-on-Write) on macOS, and hardlink on Linux and Windows.UV_KEYRING_PROVIDER environment variable.
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--link-mode link-modeclone (also known as Copy-on-Write) on macOS, and hardlink on Linux and Windows.UV_KEYRING_PROVIDER environment variable.
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--link-mode link-modeclone (also known as Copy-on-Write) on macOS, and hardlink on Linux and Windows.UV_KEYRING_PROVIDER environment variable.
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--link-mode link-modeUV_KEYRING_PROVIDER environment variable.
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--link-mode link-modeclone (also known as Copy-on-Write) on macOS, and hardlink on Linux and Windows.UV_KEYRING_PROVIDER environment variable.
Possible values:
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--link-mode link-modeThe method to use when installing packages from the global cache.
Defaults to clone (also known as Copy-on-Write) on macOS, and hardlink on Linux and Windows.
May also be set with the UV_KEYRING_PROVIDER environment variable.
Possible values:
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--managed-pythonRequire use of uv-managed Python versions.
By default, uv prefers using Python versions it manages. However, it will use system Python versions if a uv-managed Python is not installed. This option disables use of system Python versions.
@@ -4545,6 +4560,7 @@ uv pip list [OPTIONS]May also be set with the UV_KEYRING_PROVIDER environment variable.
Possible values:
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--managed-pythonRequire use of uv-managed Python versions.
By default, uv prefers using Python versions it manages. However, it will use system Python versions if a uv-managed Python is not installed. This option disables use of system Python versions.
@@ -4720,6 +4736,7 @@ uv pip tree [OPTIONS]May also be set with the UV_KEYRING_PROVIDER environment variable.
Possible values:
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--managed-pythonRequire use of uv-managed Python versions.
By default, uv prefers using Python versions it manages. However, it will use system Python versions if a uv-managed Python is not installed. This option disables use of system Python versions.
@@ -4912,6 +4929,7 @@ uv venv [OPTIONS] [PATH]May also be set with the UV_KEYRING_PROVIDER environment variable.
Possible values:
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--link-mode link-modeThe method to use when installing packages from the global cache.
This option is only used for installing seed packages.
@@ -5068,6 +5086,7 @@ uv build [OPTIONS] [SRC]May also be set with the UV_KEYRING_PROVIDER environment variable.
Possible values:
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--link-mode link-modeThe method to use when installing packages from the global cache.
This option is only used when building source distributions.
@@ -5220,6 +5239,7 @@ uv publish --publish-url https://upload.pypi.org/legacy/ --check-url https://pypMay also be set with the UV_KEYRING_PROVIDER environment variable.
Possible values:
disabled: Do not use keyring for credential lookupnative: Use the system keyring for credential lookupsubprocess: Use the keyring command for credential lookup--managed-pythonRequire use of uv-managed Python versions.
By default, uv prefers using Python versions it manages. However, it will use system Python versions if a uv-managed Python is not installed. This option disables use of system Python versions.
diff --git a/uv.schema.json b/uv.schema.json index 6deddd4be..710c28167 100644 --- a/uv.schema.json +++ b/uv.schema.json @@ -1144,6 +1144,11 @@ "type": "string", "const": "disabled" }, + { + "description": "Use the system keyring for credential lookup.", + "type": "string", + "const": "native" + }, { "description": "Use the `keyring` command for credential lookup.", "type": "string",