thebjorn/pydeps

Pydeps is not showing internal imports, only external

Closed this issue · 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!!!

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.

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