Skip to content
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 uv dev and optional dependencies #8134

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nikpivkin
Copy link
Contributor

@nikpivkin nikpivkin commented Dec 19, 2024

Description

This PR adds support for optional and dev dependencies. Optional dependencies are handled the same way for poetry. The optional dependencies of the root package are added as direct and the rest as indirect.

Without --include-dev-deps

❯ ./trivy fs /Users/nikita/projects/trivy-test/uv-test -q --list-all-pkgs -f json | jq '.Results[] | .Packages[] | select(.Name == "pytest")'

With--include-dev-deps

❯ ./trivy fs /Users/nikita/projects/trivy-test/uv-test -q --list-all-pkgs -f json --include-dev-deps | jq '.Results[] | .Packages[] | select(.Name == "pytest")'
{
  "ID": "pytest@8.3.4",
  "Name": "pytest",
  "Identifier": {
    "PURL": "pkg:pypi/pytest@8.3.4",
    "UID": "5ccb63bab9c8e426"
  },
  "Version": "8.3.4",
  "Dev": true,
  "Relationship": "direct",
  "DependsOn": [
    "colorama@0.4.6",
    "iniconfig@2.0.0",
    "packaging@24.2",
    "pluggy@1.5.0"
  ],
  "Layer": {}
}

pyptoject.toml:

[project]
name = "uv-test"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"

[dependency-groups]
test = [
    "pytest>=8.3.4",
]

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
@nikpivkin nikpivkin marked this pull request as ready for review December 19, 2024 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant