Skip to content

Deptry seemingly doesn't respect root folder and --config arguments #1484

Description

@dodofarm

Environment

  • deptry version: deptry 0.24.0
  • Python version: 3.14
  • Operating system (e.g. Ubuntu 22.04, Windows 11): Ubuntu WSL on Windows 11

Describe the issue

I have an issue where deptry doesn't seem to work in my uv workspace/monorepo setup.

Using uv run deptry ./packages/etl-users/ --config ./packages/etl-users/pyproject.toml --verbose produces no output.

Whereas doing cd ./packages/etl-users/ && uv run deptry . --verbose works as expected and shows the various errors.

Is this something not supported by deptry?

Minimal way to reproduce the issue

I can't really upload my monorepo, but here are my pyproject.toml files:

root pyproject.toml

[project]
name = "sample-python-monorepo"
version = "0.0.0"
description = "Sample monorepo with multiple ETL packages using uv workspaces"
requires-python = ">=3.14"

[tool.uv.workspace]
members = ["packages/*"]

# No runtime dependencies live here, they live in the individual packages' pyproject.toml
[dependency-groups]
dev = [
    "coverage",
    "deptry",
    "pytest",
    "pytest-asyncio",
    "ruff",
    "pyright[nodejs]",
    "pytest-randomly",
    "pytest-mock"
]

[tool.coverage.run]
branch = true

[tool.coverage.report]
show_missing = true
skip_covered = true
exclude_lines = [
    'if TYPE_CHECKING:',
    'pragma: no cover',
    "if __name__ == '__main__':",
]

[tool.ruff]
line-length = 120
target-version = "py314"
lint.select = ["ALL"]
lint.ignore = [
    "ANN401",   # Disallow typing.Any
    "ANN204",   # Require return type annotation for magic methods
    "COM812",   # Require trailing commas - conflicts with ruff formatter
    "D105",     # Require docstrings in magic methods
    "D200",     # Require one-line docstrings to fit on one line
    "D203",     # Require 1 blank line before class docstring
    "D212",     # Require multi-line docstring summary to start at the first line
    "D400",     # Require first line of docstring to end with a period
    "D401",     # Require first line of docstring to be in imperative mood
    "D415",     # Require first line of docstring to end with punctuation
    "FIX002",   # Require TODO comments to contain issue links
    "PGH003",   # Disallow blanket type: ignore comments
    "TC002",    # Require third-party imports only used for type annotations to be in TYPE_CHECKING blocks
    "TC003",    # Require standard imports only used for type annotations to be in TYPE_CHECKING blocks
    "TD002",    # Require author in TODO comments
    "TD003",    # Require issue link in TODO comments
    "TRY003",   # Disallow long exception messages outside exception class
    "TRY400"    # Require logging.exception instead of logging.error in exception handlers
]
lint.unfixable = []

[tool.ruff.lint.per-file-ignores]
"packages/*/tests/*" = [
    "DTZ001",   # Require tzinfo in datetime constructors
    "INP001",   # Require packages to to have a __init__.py file
    "PLR2004",  # Disallow magic values
    "PLR0913",  # Disallow too many arguments
    "S101",     # Disallow use of assert
    "SLF001",   # Disallow accessing private members
    "S311",     # Disallow usage of pseudo-random generators
]
".github/scripts/*" = [
    "T20",      # Allow print statements in CI scripts
]

[tool.pyright]
pythonVersion = "3.14"
pythonPlatform = "Linux"
typeCheckingMode = "strict"

executionEnvironments = [
    { root = "tests", reportPrivateUsage = false },
    { root = "packages/etl-orders", extraPaths = ["packages/etl-orders/src"] },
    { root = "packages/etl-users", extraPaths = ["packages/etl-users/src"] }
]

package-level pyproject.toml:

[project]
name = "etl-users"
version = "0.1.0"
description = "ETL pipeline for user data"
requires-python = ">=3.14"
dependencies = [
    "pandas>=2.0.0",
    "sqlalchemy>=2.0.0",
]

[project.scripts]
etl-users = "etl_users.main:main"

[build-system]
requires = ["uv_build>=0.8.5,<0.9.0"]
build-backend = "uv_build"

[tool.bergschacht.artifacts.etl-users]
type = "docker"

Expected behavior
I would expect the same output when running the tool from the root directory and passing the various arguments as when I cd into the respective package.

Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions