Skip to content

Commit

Permalink
Add parameters to method c4_graph; Refactor file structure
Browse files Browse the repository at this point in the history
  • Loading branch information
jieyinybl committed Nov 23, 2020
1 parent e9fa485 commit c52f1af
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 77 deletions.
File renamed without changes.
10 changes: 2 additions & 8 deletions c4/graph.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import os
import graphviz
import pathlib

from c4.architectures.dwh import dwh


def _content(element):
return f'{element.name}\n\n{element.description}'


def c4_graph(context):
def c4_graph(context, format='png', filename='architecture_graph', directory=pathlib.Path('architectures/')):
attr = {'node_attr': {'shape': 'record',
'fontsize': '6'},
'edge_attr': {'fontsize': '6',
Expand Down Expand Up @@ -39,7 +36,4 @@ def c4_graph(context):
for usage in system.usages:
graph.edge(_content(system), _content(usage.target), label=usage.description)

graph.render(format='png', filename='architecture_graph', directory=pathlib.Path('c4/images/'))


c4_graph(dwh)
graph.render(format=format, filename=filename, directory=directory)
68 changes: 0 additions & 68 deletions c4/images/architecture_graph

This file was deleted.

Binary file removed c4/images/architecture_graph.png
Binary file not shown.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='c4-achitecture',
version='0.1dev',
version='0.1',
install_requires=[
'graphviz'
],
Expand Down

0 comments on commit c52f1af

Please sign in to comment.