Respect pyproject.toml credentials from user-provided requirements (#7474)

## Summary

When syncing a lockfile, we need to respect credentials defined in the
`pyproject.toml`, even if they won't be used for resolution.
Unfortunately, this includes credentials in `tool.uv.sources`,
`tool.uv.dev-dependencies`, `project.dependencies`, and
`project.optional-dependencies`.

Closes https://github.com/astral-sh/uv/issues/7453.
This commit is contained in:
Charlie Marsh 2024-09-17 15:09:11 -04:00 committed by GitHub
parent 08a7c708d1
commit c2ad31aa58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 317 additions and 29 deletions

View file

@ -1,8 +1,6 @@
use std::sync::LazyLock;
use url::Url;
use crate::credentials::GitStore;
pub use crate::credentials::{store_credentials_from_url, GIT_STORE};
pub use crate::git::GitReference;
pub use crate::resolver::{
GitResolver, GitResolverError, RepositoryReference, ResolvedRepositoryReference,
@ -16,11 +14,6 @@ mod resolver;
mod sha;
mod source;
/// Global authentication cache for a uv invocation.
///
/// This is used to share Git credentials within a single process.
pub static GIT_STORE: LazyLock<GitStore> = LazyLock::new(GitStore::default);
/// A URL reference to a Git repository.
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Hash, Ord)]
pub struct GitUrl {