-
Notifications
You must be signed in to change notification settings - Fork 2.4k
solver: fix dependency resolution for self-referential extras with duplicate dependencies #10488
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
solver: fix dependency resolution for self-referential extras with duplicate dependencies #10488
Conversation
…plicate dependencies
Reviewer's GuideThis PR adds a merge_extras flag to the package factory to control merging of optional self-referential dependencies, updates tests to parameterize and validate both merged and unmerged scenarios with duplicate extras, and adjusts the solver provider to use deduplicated extras sets when resolving overlapping markers. Class diagram for updated dependency resolution in ProviderclassDiagram
class Provider {
_active_root_extras
complete_package(package, dependency, ...)
_resolve_overlapping_markers(package, deps, active_extras)
}
class Package {
is_root()
}
class Dependency {
extras
}
Provider --> Package : uses
Provider --> Dependency : uses
Provider : +complete_package() now uses found_extras instead of dependency.extras for non-root
Class diagram for PackageFactory with merge_extras flagclassDiagram
class PackageFactory {
merge_extras : bool
create_package(...)
}
PackageFactory : +merge_extras flag controls merging of self-referential extras
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @radoering - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `tests/puzzle/test_solver.py:597` </location>
<code_context>
"py310": ["py310-package ; python_version > '3.8'"],
- "all": ["a[download,install]"],
+ "all": ["a[download,download2,install]"],
"py": ["a[py38,py310]"],
"nested": ["a[all]"],
},
</code_context>
<issue_to_address>
Missing test for conflicting or overlapping markers in extras.
Please add a test where two extras reference the same dependency with different markers to verify correct marker merging and dependency resolution.
</issue_to_address>
### Comment 2
<location> `tests/puzzle/test_solver.py:598` </location>
<code_context>
- "all": ["a[download,install]"],
+ "all": ["a[download,download2,install]"],
"py": ["a[py38,py310]"],
"nested": ["a[all]"],
},
+ merge_extras=merge_extras,
</code_context>
<issue_to_address>
Consider adding a test for circular or deeply nested extras.
Adding a test for circular references between extras (e.g., 'a[foo]' includes 'a[bar]' and vice versa) would help verify that the resolver handles such cases without infinite loops or incorrect resolutions.
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Pull Request Check List
Resolves: #10434
Summary by Sourcery
Fix solver dependency resolution for self-referential extras containing duplicate dependencies and extend test fixtures to cover merged extra markers
Enhancements:
Tests: