ronaldoussoren / modulegraph2

Modulegraph2 is a library for creating and introspecting the dependency graph between Python modules.
MIT License
11 stars 8 forks source link

mg.iter_graph() is strangely absent from reference docs #24

Closed shakfu closed 1 year ago

shakfu commented 1 year ago

I just wanted to highlight that the ability to iterate over the graph should be more prominent in the reference docs, since it is such a typical use case.

In fact, I thought, this would come intuitively:

mg = modulegraph2.ModuleGraph()
mg.add_module('test_import')
for I in mg:
    print(i)

but got a TypeError: 'ModuleGraph' object is not iterable

Then looking how .report() was implemented highlighted the use of .iter_graph() which is part of your objectgraph api.

Anyway, no biggie, just want to ask you to include an iteration example in the reference docs to prevent future confusion.

ronaldoussoren commented 1 year ago

I've added a graph iteration example in d7921e4. Note that documentation already mentions that the graph is a subclass of objectgraph.ObjectGraph

shakfu commented 1 year ago

@ronaldoussoren Thanks!