Question about listing dependencies in python proj...
# general
p
Question about listing dependencies in python projects. How do I list internal dependencies within a project? I have a large monorepo, and it would be super useful to see what other modules in the repo that module A depends on
1
h
p
Yeah! I must be missing some subtleties here. But lets say I have
Copy code
code/
  A/
    a.py
  B/
    b.py
And in
b.py
I have
Copy code
from code.A.a import a_function
How do I see that
b.py
depends on
a.py
using the
dependencies
goal?
h
you would say
./pants dependencies path/to/b.py
or
./pants dependencies --transitive path/to/b.py
. If you're not seeing what you'd expect, then dependency inference isn't working for some reason: https://www.pantsbuild.org/docs/troubleshooting#import-errors-and-missing-dependencies
p
Yeah inference doesn't appear to be working the way I would expect. It correctly lists all my third part dependencies but misses all the internal dependencies
h
Okay, so this would be the section in that guide "Is the missing import from first-party code? Common issues:" It sounds like this is likely source roots not set up correctly yet
p
ah ha! It was my source root for sure. My repo is still in [this format](https://www.pantsbuild.org/docs/source-roots#no-source-root). Thanks a ton for sorting that out (and my apologies for not reading through the docs more thoroughly before jumping in here 😛)
h
awesome! and nothing to apologize at all for - we know our onboarding docs are too hard to follow, and @ancient-vegetable-10556 is leading a project to rewrite them 🙂