-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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(python): add support for poetry dev dependencies #8152
Conversation
Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
551a7ba
to
4ab4d2b
Compare
Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
func getDevDeps(project pyproject.PyProject) set.Set[string] { | ||
deps := set.New[string]() | ||
for _, groupDeps := range project.Tool.Poetry.Groups { | ||
deps.Append(groupDeps.Dependencies.Items()...) | ||
} | ||
return deps | ||
} |
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.
I suggest 2 changes:
- rename function (see https://go.dev/doc/effective_go#Getters)
- move
project.Tool.Poetry.Dependencies
into function.
func getDevDeps(project pyproject.PyProject) set.Set[string] { | |
deps := set.New[string]() | |
for _, groupDeps := range project.Tool.Poetry.Groups { | |
deps.Append(groupDeps.Dependencies.Items()...) | |
} | |
return deps | |
} | |
func directDeps(project pyproject.PyProject) set.Set[string] { | |
deps := project.Tool.Poetry.Dependencies | |
for _, groupDeps := range project.Tool.Poetry.Groups { | |
deps.Append(groupDeps.Dependencies.Items()...) | |
} | |
return deps | |
} |
return deps | ||
} | ||
|
||
func getProdPackages(app *types.Application, prodRootDeps set.Set[string]) set.Set[string] { |
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.
func getProdPackages(app *types.Application, prodRootDeps set.Set[string]) set.Set[string] { | |
func prodPackages(app *types.Application, prodRootDeps set.Set[string]) set.Set[string] { |
@@ -26,7 +26,7 @@ The following table provides an outline of the features Trivy offers. | |||
|-----------------|------------------|:-----------------------:|:----------------:|:------------------------------------:|:--------:|:----------------------------------------:| | |||
| pip | requirements.txt | - | Include | - | ✓ | ✓ | | |||
| Pipenv | Pipfile.lock | ✓ | Include | - | ✓ | Not needed | | |||
| Poetry | poetry.lock | ✓ | Exclude | ✓ | - | Not needed | | |||
| Poetry | poetry.lock | ✓ | Include | ✓ | - | Not needed | |
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.
link for Include
(#8134 (comment))
Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
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.
LGTM
@@ -26,7 +26,7 @@ The following table provides an outline of the features Trivy offers. | |||
|-----------------|------------------|:-----------------------:|:----------------:|:------------------------------------:|:--------:|:----------------------------------------:| | |||
| pip | requirements.txt | - | Include | - | ✓ | ✓ | | |||
| Pipenv | Pipfile.lock | ✓ | Include | - | ✓ | Not needed | | |||
| Poetry | poetry.lock | ✓ | Exclude | ✓ | - | Not needed | | |||
| Poetry | poetry.lock | ✓ | [Include](#poetry) | ✓ | - | Not needed | |
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.
ditto
#8134 (comment)
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.
Fixed b5bafda
Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
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.
LGTM
Description
Related PRs
Checklist