Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output action items for users when some dependency issues are found #378

Open
lisphilar opened this issue May 9, 2023 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@lisphilar
Copy link

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]
@lisphilar lisphilar added the enhancement New feature or request label May 9, 2023
@fpgmaas
Copy link
Owner

fpgmaas commented May 15, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants