Skip to content

Update version of dependency-groups to v1.3.1 #13373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions news/13372.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Names in dependency group includes are now normalized before lookup, which
fixes incorrect ``Dependency group '...' not found`` errors.
1 change: 1 addition & 0 deletions news/dependency-groups.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Upgrade dependency-groups to 1.3.1
18 changes: 7 additions & 11 deletions src/pip/_vendor/dependency_groups/_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def _normalize_name(name: str) -> str:


def _normalize_group_names(
dependency_groups: Mapping[str, str | Mapping[str, str]]
dependency_groups: Mapping[str, str | Mapping[str, str]],
) -> Mapping[str, str | Mapping[str, str]]:
original_names: dict[str, list[str]] = {}
normalized_groups = {}
Expand Down Expand Up @@ -171,17 +171,16 @@ def _resolve(self, group: str, requested_group: str) -> tuple[Requirement, ...]:
if isinstance(item, Requirement):
resolved_group.append(item)
elif isinstance(item, DependencyGroupInclude):
if item.include_group in self._include_graph_ancestors.get(group, ()):
include_group = _normalize_name(item.include_group)
if include_group in self._include_graph_ancestors.get(group, ()):
raise CyclicDependencyError(
requested_group, group, item.include_group
)
self._include_graph_ancestors[item.include_group] = (
self._include_graph_ancestors[include_group] = (
*self._include_graph_ancestors.get(group, ()),
group,
)
resolved_group.extend(
self._resolve(item.include_group, requested_group)
)
resolved_group.extend(self._resolve(include_group, requested_group))
else: # unreachable
raise NotImplementedError(
f"Invalid dependency group item after parse: {item}"
Expand All @@ -206,8 +205,5 @@ def resolve(
:raises LookupError: if group name is absent
:raises packaging.requirements.InvalidRequirement: if a specifier is not valid
"""
return tuple(
str(r)
for group in groups
for r in DependencyGroupResolver(dependency_groups).resolve(group)
)
resolver = DependencyGroupResolver(dependency_groups)
return tuple(str(r) for group in groups for r in resolver.resolve(group))
2 changes: 1 addition & 1 deletion src/pip/_vendor/vendor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ setuptools==70.3.0
tomli==2.2.1
tomli-w==1.2.0
truststore==0.10.1
dependency-groups==1.3.0
dependency-groups==1.3.1