Skip to content

Commit c4c1e01

Browse files
committed
doc: Changed the Dependency Graph Reports section in readme.
- The current example use python `requests` library to demonstrate how to create a dependency graph. - The current section also include a rendered `mermaid` diagram of the dependency graph.
1 parent 8d94876 commit c4c1e01

1 file changed

Lines changed: 103 additions & 11 deletions

File tree

README.md

Lines changed: 103 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -398,21 +398,113 @@ def test_no_forbidden_dependency():
398398

399399
Generate dependency graph reports in multiple formats and narrow them to the part of the codebase you want to inspect.
400400

401+
**Using `requests` library repo for example**
402+
401403
```python
402404
from archunitpython import project_graph
403405

404406
def test_export_dependency_graph_reports():
405-
graph = project_graph("src/").titled("Application Architecture")
406-
407-
graph.collapse_to_folder_depth(2).export_as_mermaid(
408-
"reports/dependencies.mmd"
409-
)
410-
411-
graph.focus_on("**/domain/**", 1).export_as_html(
412-
"reports/domain-dependencies.html"
413-
)
414-
415-
assert graph.snapshot().summary.node_count >= 0
407+
graph = project_graph("src/requests").titled("Application Architecture")
408+
409+
graph.collapse_to_folder_depth(2).export_as_mermaid("reports/dependencies.md")
410+
411+
if __name__ == "__main__":
412+
test_export_dependency_graph_reports()
413+
```
414+
**Rendered mermain diagram**
415+
``` mermaid
416+
flowchart LR
417+
n0["__init__.py"]
418+
n1["__version__.py"]
419+
n2["_internal_utils.py"]
420+
n3["_types.py"]
421+
n4["adapters.py"]
422+
n5["api.py"]
423+
n6["auth.py"]
424+
n7["certs.py"]
425+
n8["compat.py"]
426+
n9["cookies.py"]
427+
n10["exceptions.py"]
428+
n11["help.py"]
429+
n12["hooks.py"]
430+
n13["models.py"]
431+
n14["packages.py"]
432+
n15["sessions.py"]
433+
n16["status_codes.py"]
434+
n17["structures.py"]
435+
n18["utils.py"]
436+
n0 --> n1
437+
n0 --> n5
438+
n0 --> n10
439+
n0 --> n13
440+
n0 --> n15
441+
n0 --> n16
442+
n2 --> n8
443+
n3 --> n6
444+
n3 --> n9
445+
n3 --> n13
446+
n3 --> n17
447+
n4 --> n0
448+
n4 --> n3
449+
n4 --> n6
450+
n4 --> n8
451+
n4 --> n9
452+
n4 --> n10
453+
n4 --> n13
454+
n4 --> n17
455+
n4 --> n18
456+
n5 --> n0
457+
n5 --> n13
458+
n6 --> n2
459+
n6 --> n8
460+
n6 --> n9
461+
n6 --> n13
462+
n6 --> n18
463+
n9 --> n2
464+
n9 --> n3
465+
n9 --> n8
466+
n9 --> n13
467+
n10 --> n8
468+
n10 --> n13
469+
n11 --> n0
470+
n12 --> n0
471+
n12 --> n13
472+
n13 --> n0
473+
n13 --> n2
474+
n13 --> n4
475+
n13 --> n6
476+
n13 --> n8
477+
n13 --> n9
478+
n13 --> n10
479+
n13 --> n12
480+
n13 --> n16
481+
n13 --> n17
482+
n13 --> n18
483+
n14 --> n8
484+
n15 --> n0
485+
n15 --> n2
486+
n15 --> n3
487+
n15 --> n4
488+
n15 --> n6
489+
n15 --> n8
490+
n15 --> n9
491+
n15 --> n10
492+
n15 --> n12
493+
n15 --> n13
494+
n15 --> n16
495+
n15 --> n17
496+
n15 --> n18
497+
n16 --> n17
498+
n17 --> n8
499+
n18 --> n0
500+
n18 --> n1
501+
n18 --> n2
502+
n18 --> n3
503+
n18 --> n8
504+
n18 --> n9
505+
n18 --> n10
506+
n18 --> n13
507+
n18 --> n17
416508
```
417509

418510
Supported formats:

0 commit comments

Comments
 (0)