pydeps icon indicating copy to clipboard operation
pydeps copied to clipboard

Pydeps is not showing internal imports, only external

Open gustavonmartins opened this issue 5 years ago • 2 comments

Background: I have an app writen in fastapi and its slowing getting too big, so I want to reorganize it after getting inspired by a visual representation of my internal imports.

Goal: I needto make a graph showing how my internal modules are using each other, in the hopes that it will inspire me to reorganise my code to be less confusing. I would like to have something like this:

I have a folder structure like this: image I would like to know, for instance, how the modules of each of my subfolders are importing each other. Ideally I would get something similar to this graph, but applied to my folder structure: image

Problem: I tried creating this by typing pydeps app, pydeps app.main, pydeps app/routers, etc, and I can only see how my app is calling external modules, like pandas, fastapi, etc. Here is the result: image

What I already tried: -Running pydeps from my virtual environment (i thought it could be that a global install wouldnt understand my project structure), but nothing helps. -Changing bacon number -Playing with other arguments

Need for help: I dont see what I am doing wrong. Is there a configuration I am overseeing?

Thank you so much!!!

gustavonmartins avatar Dec 10 '20 11:12 gustavonmartins

There is unfortunately currently no way of doing what you want. I believe you want the same as #39. The internal tool I reference in that question only works across modules however, so it wasn't a viable solution. Being able to set the max depth (of the dotted module path) seems like a good idea though...

You can get some of what you want by manually listing your submodules...:

pydeps app --only app.models app.repos app.routers app.schemas 

etc.

thebjorn avatar Dec 10 '20 12:12 thebjorn

Your tips helped me to narrow down the source of my problem, thanks!!

My problem was actually NO internal dependencies where show. I tracked this to be because I had an init.py in the root folder. After I removed it, I can see my internal dependencies, and I dont see that annoying name_of_root_folder in all graphs (in my image it was tama_backend).

Thank you so much!!

I have another question, but I will put it on other issue, as it might enable other people to reuse my question

gustavonmartins avatar Dec 10 '20 13:12 gustavonmartins