Skip to content

Respect uv groups #1376

@mil-ad

Description

@mil-ad

I have a dependency in two groups with one group included in the defaults like below:

dependencies = [
   # some deps
]

[dependency-groups]

dev = [
  # some dev deps
]

cpu = [
  "torch>=2.2.2",
]

gpu = [
  "torch>=2.2.2",
]

[tool.uv]
default-groups = ["dev", "gpu"]
conflicts = [
  [
    { group = "cpu" },
    { group = "gpu" },
  ],
]

[[tool.uv.index]]
name = "pytorch-cu118"
url = "https://download.pytorch.org/whl/cu118"
explicit = true

[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true

[tool.uv.sources]
torch = [
  { index = "pytorch-cpu", group = "cpu" },
  { index = "pytorch-cu118", group = "gpu", marker = "platform_system == 'Linux'" },
]

deptry doesn't seem to recognise these uv groups and complains:

DEP004 'torch' imported but declared as a dev dependency

Would be nice if it could detect this scenario.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions