Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

installation.md 1.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ---
  2. id: installation
  3. title: Installation
  4. ---
  5. It requires **Python 3.6** or higher, check your Python version first.
  6. 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**.
  7. > macOS users can download the Graphviz via `brew install graphviz` if you're using [Homebrew](https://brew.sh). Similarly, Windows users with [Chocolatey](https://chocolatey.org) installed can run `choco install graphviz`.
  8. ```shell
  9. # using pip (pip3)
  10. $ pip install diagrams
  11. # using pipenv
  12. $ pipenv install diagrams
  13. # using poetry
  14. $ poetry add diagrams
  15. ```
  16. ## Quick Start
  17. ```python
  18. # diagram.py
  19. from diagrams import Diagram
  20. from diagrams.aws.compute import EC2
  21. from diagrams.aws.database import RDS
  22. from diagrams.aws.network import ELB
  23. with Diagram("Web Service", show=False):
  24. ELB("lb") >> EC2("web") >> RDS("userdb")
  25. ```
  26. This code generates below diagram.
  27. ```shell
  28. $ python diagram.py
  29. ```
  30. ![web service diagram](/img/web_service_diagram.png)
  31. It will be saved as `web_service.png` on your working directory.
  32. ## Next
  33. See more [Examples](/docs/getting-started/examples) or see [Guides](/docs/guides/diagram) page for more details.