mirror of https://github.com/mingrammer/diagrams
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
---
|
|
id: installation
|
|
title: Installation
|
|
---
|
|
|
|
It uses [Graphviz](https://www.graphviz.org/) to render the diagram, so you need to [install Graphviz](https://graphviz.gitlab.io/download/) to use **diagrams**. After installing graphviz (or already have it), install the **diagrams**.
|
|
|
|
> macOS users can download the Graphviz via `brew install graphviz` if you're using [Homebrew](https://brew.sh).
|
|
|
|
```shell
|
|
# using pip (pip3)
|
|
$ pip install diagrams
|
|
|
|
# using pipenv
|
|
$ pipenv install diagrams
|
|
|
|
# using poetry
|
|
$ poetry add diagrams
|
|
```
|
|
|
|
## Quick Start
|
|
|
|
```python
|
|
# diagram.py
|
|
from diagrams import Diagram
|
|
from diagrams.aws.compute import EC2
|
|
from diagrams.aws.database import RDS
|
|
from diagrams.aws.network import ELB
|
|
|
|
with Diagram("Web Service", show=False):
|
|
ELB("lb") >> EC2("web") >> RDS("userdb")
|
|
```
|
|
|
|
This code generates below diagram.
|
|
|
|
```shell
|
|
$ python diagram.py
|
|
```
|
|
|
|
![web service diagram](/img/web_service_diagram.png)
|
|
|
|
It will be saved as `web_service.png` on your working directory.
|
|
|
|
## Next
|
|
|
|
See more [Examples](/docs/getting-started/examples) or see [Guides](/docs/guides/diagram) page for more details.
|