Handling Dependencies Used Indirectly via Frameworks #729
-
I’m trying out Deptry to find unused, missing and transitive dependencies in a project for a FastAPI app. Deptry flags
I invoke uvicorn in my application with poetry show --tree
Some solutions to this would be:
Is deptry not parsing the poetry dependency tree at all in order to consider project dependencies? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Thanks for raising this, it is an interesting point. Scanning the dependency tree would not solve this; If my project has In this case, I think the most sensible solution would be either to remove
Hope this helps. Let me know if you have any other thoughts! |
Beta Was this translation helpful? Give feedback.
Thanks for raising this, it is an interesting point.
deptry
looks for imports in your codebase to determine which libraries are actually used. In this case, as you correctly noticedeptry
considersuvicorn
as not used since it is not imported.Scanning the dependency tree would not solve this; If my project has
A
as a transitive dependency because it is required byB
, that does not imply that I should haveA
also in my list of dependencies. Only when I actively useA
should I also list it in my project's dependencies. In your situation the latter is the case, but since for deptry 'actively use' is synonymous to 'import' it fails to pick this up.In this case, I think the most sensible sol…