Deptry should have a way to map package names to module names
akeeman opened this issue · 1 comments
Is your feature request related to a problem? Please describe.
Sometimes the dependency name doesn't translate to the module name used by a dependency. Normally that won't be a problem, but it's becoming a problem when the dependency is optional and not installed. In that case a guess is made that a dependency, e.g. foo-python
, translates to module, e.g. foo_python
:
Warning: Package 'foo-python' not found in current environment. Assuming its corresponding module name is 'foo_python'.
This becomes a problem when the module is actually called differently, like in this case foo
.
There were 2 dependency issues found.
-----------------------------------------------------
The project contains obsolete dependencies:
foo-python
Consider removing them from your project's dependencies. If a package is used for development purposes, you should add it to your development dependencies instead.
-----------------------------------------------------
There are dependencies missing from the project's list of dependencies:
foo
Consider adding them to your project's dependencies.
Describe the solution you would like
A possible solution would be to add some kind of mapping to the configuration with the right translation.
[tool.deptry]
package_module_name_map = { "foo-python": "foo" }
or equivalent
[tool.deptry.package_module_name_map]
foo-python = "foo"
Additional context
N/A
Hey! Thanks for raising the issue and creating a PR. I think this would be a very nice feature to have.