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

uv workspace gives strange results #1060

Open
cospectrum opened this issue Feb 20, 2025 · 1 comment
Open

uv workspace gives strange results #1060

cospectrum opened this issue Feb 20, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@cospectrum
Copy link

cospectrum commented Feb 20, 2025

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

  1. each leaf package must be analyzed as if deptry was running from its root.
  2. therefore, deptry from the root package should warn about a dependency of thefirst project.
  3. deptry should not warn about "import from itself".

Additional context

@cospectrum cospectrum added the bug Something isn't working label Feb 20, 2025
@cospectrum cospectrum changed the title uv workspace does not work uv workspace gives strange results Feb 20, 2025
@mkniewallner
Copy link
Collaborator

Yeah uv workspaces are not handled for now, we'd have to explicitly add support for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants