fpgmaas/deptry

Output action items for users when some dependency issues are found

lisphilar opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
Currently, deptry shows the list of dependency issues, the number of issues, and the top page URL of documentation. They are very helpful to find issues, but it may be diffucult for some users including me to decide what to do so that we can solve the issues.

Describe the solution you would like
Show the list of action candidates with standard output (and/or output the candidates to JSON file when --json-output selected).
Action items could be categorized into the following four types.

(When pyproject.toml is the cofiguration file,)

  • edit codebase file, e.g. add a new line "import library"
  • edit pyproject.toml to add library line to [tool.poetry.dependencies] section
  • edit pyproject.toml to remove library line from (e.g.) [tool.poetry.dependencies] section
  • use a new argument or edit [tool.deptry] section of pyproject.toml

Additional context
Example of current output.

Scanning 51 files...

pyproject.toml: DEP002 'requests' defined as a dependency but not used in the codebase
Found 1 dependency issue.

For more information, see the documentation: https://fpgmaas.github.io/deptry/

Expected output regarding action items.

We can solve the issue(s) as follows.
- DEP002: remove 'requests' from pyproject.toml[tool.poetry.dependencies] or
  add a new line "ignore_obsolete = ['requests']" to pyproject.toml[tool.deptry]

Thanks for raising the issue @lisphilar! I can see how finding the solution once deptry raises an error can be difficult. However, I wonder if showing potential solutions in the command line is a good idea. Depending on the situation the solution might be different, and users might implement the wrong solution for their problem. Another reason why I think it might not be a good idea, is that the terminal output would become a bit long.

Alternatively, I see that in the documentation, the following is stated regarding DEP002:

deptry will report requests as an unused dependency because it is not used in the project.
To fix the issue, requests should be removed from [project.dependencies].

And

This check can be disabled with Skip unused option.
Specific dependencies can be ignored with Ignore unused option.

I would feel more for elaborating in the documentation, e.g. by adding more examples for each type of issue and/or by making sure the right information is easier for users to find in the documentation.