-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
fix poetry add --optional
locking
#10076
Conversation
Reviewer's Guide by SourceryThis pull request fixes an issue where optional dependencies were not being correctly added to the lock file when using the Sequence diagram for adding optional dependencysequenceDiagram
participant User as User
participant Add as AddCommand
participant Poetry as PoetryPackage
participant Lock as Locker
User->>Add: poetry add --optional dependency
Add->>Add: handle()
Note over Add: Process dependency constraints
Add->>Add: _add_dependency_to_extras()
Add->>Poetry: Get package extras
Poetry-->>Add: Current extras
Add->>Poetry: Update package extras
Add->>Lock: Refresh lock file
Lock-->>Add: Lock file updated
Add-->>User: Dependency added successfully
Class diagram for AddCommand changesclassDiagram
class AddCommand {
+handle()
-_add_dependency_to_extras(dependency: Dependency, extra_name: NormalizedName)
-notify_about_existing_packages(existing_packages: list[str])
}
class Dependency {
+name: str
+_in_extras: list[str]
}
class Poetry {
+package: Package
}
class Package {
+extras: dict
}
AddCommand --> Dependency: uses
AddCommand --> Poetry: uses
Poetry --> Package: contains
Flow diagram for optional dependency handlingflowchart TD
A[Start] --> B[Process dependency]
B --> C{Is optional?}
C -->|Yes| D[Canonicalize extra name]
D --> E[Set _in_extras]
E --> F[Add to extras]
F --> G[Update lock file]
C -->|No| G
G --> H[End]
File-Level Changes
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 - here's some feedback:
Overall Comments:
- Please add documentation updates explaining the fixed behavior of
poetry add --optional
. This will help users understand how optional dependencies are now handled correctly.
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.
2eefadd
to
97b62e1
Compare
Pull Request Check List
Resolves: #10041
Summary by Sourcery
Fix optional dependency locking when adding a new optional dependency.
Bug Fixes:
poetry add --optional
would not correctly update the lock file.Tests: