deptry
deptry copied to clipboard
Support uv workspaces
Environment
- deptry version: 0.23.0
- Python version: 3.10.16
- Operating system (e.g. Ubuntu 22.04, Windows 11): macos
Describe the issue
uv run deptry . for uv-workspace gives bad results that on location.
Minimal way to reproduce the issue
project structure:
root/
pyproject.toml
uv.lock
packages/
first/
pyproject.toml
src/
first/
__init__.py
...
second/
pyproject.toml
src/
second/
__init__.py
root pyproject.toml:
[project]
name = "uv-workspace"
version = "0.1.0"
description = "uv workspace"
readme = "README.md"
requires-python = ">=3.10"
dependencies = []
[tool.uv.workspace]
members = ["packages/*"]
first pyproject.toml:
[project]
name = "first"
version = "0.1.0"
description = "first"
readme = "README.md"
requires-python = ">=3.10"
dependencies = ["second", "b"] # note: there is no "a", but it is imported in the `src/first/*` files for more complex behavior
[tool.uv.sources]
second = { workspace = true }
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
second pyproject.toml:
[project]
name = "second"
version = "0.1.0"
description = "second"
readme = "README.md"
requires-python = ">=3.10"
dependencies = []
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
root/packages/first/src/first/*.py files contain imports for the following modules:
second, a, b and first (import from itself).
uv run deptry . inside the root dir warns about the following depndencies of the first module: b, first, second.
uv run deptry . inside the first dir warns about the following depndencies of the first module: a, first.
Expected behavior
- each
leaf packagemust be analyzed as ifdeptrywas running from its root. - therefore,
deptryfrom therootpackage should warn aboutadependency of thefirstproject. deptryshould not warn about "import from itself".
Additional context