Skip to content

Commit

Permalink
Check dependency groups for credentials (#8393)
Browse files Browse the repository at this point in the history
## Summary

We have to iterate over all user-defined dependencies here. We were
missing the new `[dependency-groups]` section.

Part of #8272.
  • Loading branch information
charliermarsh committed Oct 25, 2024
1 parent 0695566 commit 1a007a1
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion crates/uv/src/commands/project/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use uv_python::{PythonDownloads, PythonEnvironment, PythonPreference, PythonRequ
use uv_resolver::{FlatIndex, Lock};
use uv_types::{BuildIsolation, HashStrategy};
use uv_warnings::warn_user;
use uv_workspace::pyproject::{Source, Sources, ToolUvSources};
use uv_workspace::pyproject::{DependencyGroupSpecifier, Source, Sources, ToolUvSources};
use uv_workspace::{DiscoveryOptions, InstallTarget, MemberDiscovery, VirtualProject, Workspace};

use crate::commands::pip::loggers::{DefaultInstallLogger, DefaultResolveLogger, InstallLogger};
Expand Down Expand Up @@ -480,6 +480,21 @@ fn store_credentials_from_workspace(workspace: &Workspace) {
.into_iter()
.flat_map(|optional| optional.values())
.flatten();
let dependency_groups = member
.pyproject_toml()
.dependency_groups
.as_ref()
.into_iter()
.flatten()
.flat_map(|(_, dependencies)| {
dependencies.iter().filter_map(|specifier| {
if let DependencyGroupSpecifier::Requirement(requirement) = specifier {
Some(requirement)
} else {
None
}
})
});
let dev_dependencies = member
.pyproject_toml()
.tool
Expand All @@ -491,6 +506,7 @@ fn store_credentials_from_workspace(workspace: &Workspace) {

for requirement in dependencies
.chain(optional_dependencies)
.chain(dependency_groups)
.filter_map(|requires_dist| {
LenientRequirement::<VerbatimParsedUrl>::from_str(requires_dist)
.map(Requirement::from)
Expand Down

0 comments on commit 1a007a1

Please sign in to comment.