-
Notifications
You must be signed in to change notification settings - Fork 256
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
feat: Support PEP 735 dependency groups #823
base: main
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis PR implements support for PEP 735 dependency groups in Poetry. The changes enhance how dependency groups are retrieved from the project configuration, integrated into package dependency resolution, propagated through dependency creation methods, and validated. New tests and fixture files have also been added to ensure proper handling of both valid and invalid dependency groups. Sequence diagram for dependency group initializationsequenceDiagram
participant Dev as Developer
participant PP as PyProject
participant F as Factory.configure_package
participant P as Package
participant DG as DependencyGroup
participant D as Dependency
Dev->>PP: Define dependency-groups in pyproject.toml
PP->>F: Provide project data with dependency-groups and tool_poetry config
F->>P: Call add_dependency_group for each group
F->>DG: Create DependencyGroup(name, optional)
DG->>P: Register group with package
loop For each dependency constraint
F->>D: Create dependency using create_from_pep_508(constraint, groups)
D->>DG: Add dependency via add_dependency(dep)
end
Note over F,D: Dependency groups are now passed and propagated during dependency creation
Updated class diagram for Dependency and DependencyGroupclassDiagram
class Package {
+add_dependency_group(group)
+has_dependency_group(group_name)
}
class DependencyGroup {
+name: str
+optional: bool
+dependencies: list
+add_dependency(dep)
}
class Dependency {
<<abstract>>
+groups: Iterable~str~
+create_from_pep_508(name, relative_to, groups)
}
class VCSDependency {
+groups: Iterable~str~
}
class URLDependency {
+groups: Iterable~str~
}
class FileDependency {
+groups: Iterable~str~
}
class DirectoryDependency {
+groups: Iterable~str~
}
Package o-- "*" DependencyGroup : holds
DependencyGroup "1" *-- "*" Dependency : contains
Dependency <|-- VCSDependency
Dependency <|-- URLDependency
Dependency <|-- FileDependency
Dependency <|-- DirectoryDependency
note for Dependency "New attribute 'groups' to support PEP 735 dependency groups"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
83710eb
to
6473ff4
Compare
6473ff4
to
e442bb4
Compare
2d7ac12
to
0a50ac3
Compare
@sourcery-ai review |
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 @finswimmer - I've reviewed your changes - here's some feedback:
Overall Comments:
- Please add documentation for the new dependency groups feature - this is a significant change that needs to be well documented for users
- Link to the relevant issue number/tracking issue for PEP 735 implementation in the PR description
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
c19b017
to
ed77a26
Compare
@sourcery-ai review |
@sourcery-ai review |
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 @finswimmer - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider consolidating the two loops in _configure_package_dependencies that handle dependency groups (one for dependency-groups and one for tool.poetry.group) to reduce repeated logic.
- If a dependency group exists in the pyproject data but lacks a corresponding tool.poetry.group entry, consider whether you want to apply default optional settings explicitly.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Required-by: python-poetry/poetry#10130
Relates-to: python-poetry/poetry#9751
Summary by Sourcery
New Features:
Summary by Sourcery
New Features: