feat(show): add dependency group output#10945
Open
Yijian6 wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new
_package_groupshelper relies on the privateroot._dependency_groupsattribute; consider using a public API or adding an accessor onProjectPackageso the command does not depend on internal implementation details of the package model. - When computing and displaying
groups_lengthin_display_packages_information, you repeatedly call_format_groupsfor the same package name; you could precompute and cache the formatted group strings (e.g.,formatted_groups[name]) to avoid duplicate work and simplify the width/printing logic.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `_package_groups` helper relies on the private `root._dependency_groups` attribute; consider using a public API or adding an accessor on `ProjectPackage` so the command does not depend on internal implementation details of the package model.
- When computing and displaying `groups_length` in `_display_packages_information`, you repeatedly call `_format_groups` for the same package name; you could precompute and cache the formatted group strings (e.g., `formatted_groups[name]`) to avoid duplicate work and simplify the width/printing logic.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Check List
Resolves: #8164
This adds a
--with-groupsoption topoetry showso users can see which dependency groups each listed package belongs to without openingpyproject.tomlor inspecting the lock file manually.For text output, the command prints a group column after the package version. For JSON output, it adds a
groupslist. When lock-file group metadata is available, the command uses it so transitive packages can also be annotated; otherwise it falls back to the active root dependency groups.--tree --with-groupsreturns a clear error because tree output does not have a tabular group column.Local checks:
Breaking changes: None.