I am wondering if Pants plugin API allows tapping ...
# plugins
f
I am wondering if Pants plugin API allows tapping into the dependency graph? Or can this be solved using existing Pants goals?
1
Scenario: given list of 5 files with the following relationships, check if all files form a single dependency graph (here
D->E
is one "island" and
A->B->C
is another one and there's no link between them)
Copy code
A -> B -> C
D -> E
@witty-crayon-22786 I know you like graphs 🙂
😉 1
w
you can use
DependenciesRequest
for this, yea. it produces the same values as would be produced by
./pants dependencies
.
if you want to prototype something externally, can use
./pants peek ::
to dump all of the dependencies. just know that the algorithm will need to be cycle tolerant
depending on the use case, you could also start by looking at the implementation of
./pants paths
, which collects the dependency graph, and then walks it: https://github.com/pantsbuild/pants/blob/main/src/python/pants/backend/project_info/paths.py
❤️ 1
f
oh perfect, I got adjacency lists, just what I need. I was hoping to avoid using
networkx
🙂