Skip to content

Commit 66a7682

Browse files
authored
Merge pull request #1 from tonystark201/dev
Dev
2 parents 7552c44 + 2860071 commit 66a7682

File tree

20 files changed

+660
-2
lines changed

20 files changed

+660
-2
lines changed

Pipfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
diagrams = "*"
8+
9+
[dev-packages]
10+
11+
[requires]
12+
python_version = "3.7"

README.md

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,82 @@
1-
# Architecture-blueprint-by-python
2-
This is a demo project mainly demostrate how to use python to draw the blueprint of the software architecture.
1+
# Draw Arch blueprint using Python
2+
## Prepare
3+
4+
+ Install chocolately
5+
6+
> Introduction: Chocolatey has the largest online registry of Windows packages. Chocolatey packages encapsulate everything required to manage a particular piece of software into one deployment artifact by wrapping installers, executables, zips, and/or scripts into a compiled package file.
7+
8+
So we use chocolately to install all the packages we needed in windows. It`s very easy to install what you needed.
9+
10+
Open PowerShell within Adminstration permission.
11+
12+
```shell
13+
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
14+
```
15+
16+
Install successfully if you can see something as below.
17+
18+
```shell
19+
PS C:\Windows\system32> choco --version
20+
1.1.0
21+
```
22+
23+
+ Install graphviz
24+
25+
```shell
26+
choco install graphviz
27+
```
28+
29+
+ Install diagrams
30+
31+
> Introduction: The Diagrams tool allows us to draw and generate system architecture diagrams using Python code. It was born to provide prototypes for those new system architecture designs without any design tools, and we can describe or visualize existing system architecture diagrams.
32+
33+
Diagrams now supports the graphics including: AWS, Azure, Kubernetes, Ali Cloud, Oracle,etc.
34+
35+
```shell
36+
pipenv install diagrams
37+
```
38+
39+
## Draw Diagrams
40+
41+
The Diagrams library has four main components, namely diagrams, nodes, clusters, edges.
42+
43+
1. The 1st core component of the Diagram library is a diagram
44+
45+
1. filename: specify the file name
46+
2. outformat: Specify the image generation format
47+
3. show: whether to display automatically after running
48+
4. graph_attr: custom Graphviz attributes
49+
5. node_attr: custom Node attributes
50+
6. edge_attr: custom edge attributes
51+
52+
2. The 2nd core component of the Diagram library is the node
53+
54+
1. Node instance, consists of three parts with `provider`,`resource type` and `name`
55+
2. Data flow
56+
1. The connection node has no direction (-)
57+
2. nodes are connected from left to right (>>)
58+
3. nodes are joined from right to left (<<)
59+
60+
3. The 3rd core component of the Diagram library is the cluster
61+
62+
Cluster allows you to group or cluster nodes in an independent group. We can use the cluster to create a cluster context and also connect nodes in the cluster to other nodes outside the cluster.
63+
64+
4. The 4th core component of the Diagram library is the edges
65+
66+
The Edge object contains three properties: label, color, and style
67+
68+
__Note: Getting started drawing is very simple, the basic essentials are to draw with the sample code as a reference. You can check and view the code in this Repo and start your drawing.__
69+
70+
## Summary
71+
72+
The Python drawing library is more practical, but if you are not familiar with `graphviz`, there will be some unsightly situations in the layout of the architecture diagram. The purpose of this library is to make drawing architecture images the same as writing code, but from the actual effect, for some simple architecture diagrams, it is more convenient to use, but for some complex architectures, the layout of the images is ugly. Therefore, this library has a long way to go if it wants to make a difference.
73+
74+
__*Thanks for reading and if you like this repo, please fork and star.*__
75+
76+
## Reference
77+
78+
+ [How to install chocolatey in Windows](https://chocolatey.org/install)
79+
+ [How to install graphviz in Windows](https://graphviz.org/download/)
80+
+ [Python diagrams guide ](https://diagrams.mingrammer.com/docs/guides/diagram)
81+
+ [Graphviz attributes](https://graphviz.gitlab.io/docs/attrs/compound/)
82+

assets/ecs1.png

106 KB
Loading

assets/eks1.png

153 KB
Loading

assets/elkb1.png

87.7 KB
Loading

assets/iot1.png

203 KB
Loading

assets/k8s1.png

365 KB
Loading

assets/ml1.png

257 KB
Loading

assets/onpre1.png

122 KB
Loading

assets/serverless1.png

143 KB
Loading

0 commit comments

Comments
 (0)