deptry icon indicating copy to clipboard operation
deptry copied to clipboard

Imports with package names different from module names are wrongly reported as missing instead of transitive

Open Willa1228 opened this issue 1 year ago • 1 comments

Environment

  • deptry version: 0.16.1
  • Python version: 3.11
  • Operating system (e.g. Ubuntu 22.04, Windows 11): Mac OS 14.0

Describe the issue

I have a project which has django-cms in its requirements.txt, and I import those packages depend on django-cms like django-classy-tags, django-formtools... those should be detected as a transitive dependency, but it seems deptry can't recognize those with a - packages's name, so it turns out detected as a missing dependency.

Minimal way to reproduce the issue

  1. Have a new project with django-cms in the requirements, and install in a conda environment
  2. In project import classytags from formtools.wizard.views import WizardView import sekizai from treebeard.mp_tree import MP_Node from packaging import version
  3. python -m deptry .

those with - will be detected as DEP001 incorrectly, but without dash's package can be detected as transitive successfully.

Willa1228 avatar Aug 21 '24 18:08 Willa1228