Skip to content

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

@Willa1228

Description

@Willa1228

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions