Hacker News new | ask | show | jobs
by VeejayRampay 824 days ago
I feel like cases where the import is different from the package name yield false positives

i.e. if I have

  beautifulsoup4[html5lib,lxml]==4.12.3

in my requirements.txt and then import with

  from bs4 import BeautifulSoup
it would complain

is there a way to configure that somehow?

aside from that, the tool is extremely fast

1 comments

This is not an issue when using `deptry`; it does not only match the import name against the dependency name; it first tries to find the modules that are provided by the dependency `beautifulsoup4`. If you run `deptry -v .`, you can see this in the verbose logs:

` Dependency 'beautifulsoup4' with top-levels: {'bs4'}.`

If you ever run into a situation where this does not work, you can use the `pacakge_module_name_map` parameter: https://fpgmaas.github.io/deptry/usage/#package-module-name-...

Hope this helps! Florian