Skip to content

Commit

Permalink
add test python notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
socheatsok78 committed Feb 24, 2020
1 parent 194601e commit 17a4be8
Show file tree
Hide file tree
Showing 8 changed files with 597 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": "/Users/socheatsok/.local/share/virtualenvs/example-diagram-_yIQ0hfF/bin/python"
}
1 change: 1 addition & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
brew "graphviz"
39 changes: 39 additions & 0 deletions Brewfile.lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"entries": {
"brew": {
"graphviz": {
"version": "2.42.2",
"bottle": {
"cellar": "/usr/local/Cellar",
"prefix": "/usr/local",
"files": {
"catalina": {
"url": "https://homebrew.bintray.com/bottles/graphviz-2.42.2.catalina.bottle.tar.gz",
"sha256": "fd65173d4f2bf9b4412f42939acc10815ba8974f5cdac342a9afd619acc70829"
},
"mojave": {
"url": "https://homebrew.bintray.com/bottles/graphviz-2.42.2.mojave.bottle.tar.gz",
"sha256": "abf938b188d15e2bf1b7447635f1e13a46baaa00f0e38ea6e5122e603f6b491d"
},
"high_sierra": {
"url": "https://homebrew.bintray.com/bottles/graphviz-2.42.2.high_sierra.bottle.tar.gz",
"sha256": "df7bafeabe8c94cc513c394ba3fa587ae2b209a25fa42f1b507dfae67029f47d"
}
}
}
}
}
},
"system": {
"macos": {
"catalina": {
"HOMEBREW_VERSION": "2.2.6-31-g2834a75",
"HOMEBREW_PREFIX": "/usr/local",
"Homebrew/homebrew-core": "32dae6428d5d9a8c0c321d18e08d16a0a13212f4",
"CLT": "11.0.33.8",
"Xcode": "11.3",
"macOS": "10.15.3"
}
}
}
}
14 changes: 14 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
jupyter = "*"
notebook = "*"

[packages]
diagrams = "*"

[requires]
python_version = "3.8"
456 changes: 456 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

84 changes: 84 additions & 0 deletions generator/generate.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"nbformat": 4,
"nbformat_minor": 2,
"metadata": {
"language_info": {
"name": "python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"version": "3.8.1-final"
},
"orig_nbformat": 2,
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"npconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": 3,
"kernelspec": {
"name": "python38164bitexamplediagrampipenv715191b3bad04cc1b3bdbbb1ff1d427d",
"display_name": "Python 3.8.1 64-bit ('example-diagram': pipenv)"
}
},
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from diagrams import Diagram\n",
"from diagrams.aws.compute import EC2\n",
"from diagrams.aws.database import RDS\n",
"from diagrams.aws.network import ELB"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"with Diagram(\"Web Service\", show=False):\n",
" ELB(\"lb\") >> EC2(\"web\") >> RDS(\"userdb\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![Web Service](web_service.png)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"with Diagram(\"Grouped Workers\", show=False, direction=\"TB\"):\n",
" ELB(\"lb\") >> [EC2(\"worker1\"),\n",
" EC2(\"worker2\"),\n",
" EC2(\"worker3\"),\n",
" EC2(\"worker4\"),\n",
" EC2(\"worker5\")] >> RDS(\"events\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![Grouped Workers](grouped_workers.png)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
]
}
Binary file added generator/grouped_workers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added generator/web_service.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 17a4be8

Please sign in to comment.