skillfed

diagrams

Diagram as Code

diagrams v0.25.1 7.5M downloads/30d#1,733 on PyPI42,508
Permissive license MIT Active released

What it is and what it does

Diagrams is a Python library for creating cloud architecture diagrams as code rather than using graphical design tools. It supports major cloud providers (AWS, Azure, GCP, Kubernetes, Alibaba Cloud, Oracle Cloud) as well as on-premises nodes, SaaS, and programming frameworks. The library uses Graphviz to render diagrams to image files, allowing you to version-control architecture documentation alongside your infrastructure code.

The package is designed for prototyping new architectures, documenting existing systems, and tracking architecture changes through version control. It does not provision cloud resources or generate infrastructure-as-code templates (Terraform, CloudFormation); it is purely for visualization. It requires Python 3.9+ and a system installation of Graphviz.

Use it for:

  • Document cloud architecture designs in version-controlled Python code for team collaboration and change tracking.
  • Prototype new system architectures quickly without opening a design tool, iterating on topology in code.
  • Generate architecture diagrams programmatically from infrastructure metadata or configuration files.
  • Create consistent, reproducible architecture visualizations for documentation and presentations.
  • Visualize multi-cloud or hybrid on-premises deployments with a unified diagram format.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Diagrams lets you draw cloud system architecture diagrams programmatically in Python, supporting major cloud providers like AWS, Azure, GCP, Kubernetes, and on-premises infrastructure.

Yes. Diagrams is actively maintained, permissively licensed, has low install friction, and fills a clear need for developers who want to treat architecture diagrams as code. The 42508 repository stars and top-5000 PyPI position confirm real adoption. The only prerequisite is a separate Graphviz installation, which is a one-time setup. Install it if you need to document or prototype cloud architectures programmatically.

Install

diagrams on PyPI

pip

pip install diagrams

uv

uv add diagrams

poetry

poetry add diagrams

Installing diagrams

Before you install

Low friction: pure Python wheel with four runtime dependencies (graphviz, jinja2, typed-ast, pre-commit). Actively maintained with recent releases; last commit 2026-08-14 and 42508 repository stars indicate stable, well-used project.

License in practice

MIT license (permissive) means you can use, modify, and distribute diagrams freely in commercial or private projects with minimal restrictions.

Quickstart

pip install diagrams

from diagrams import Diagram
from diagrams.aws.compute import EC2

with Diagram("My Architecture"):
    EC2("web")

Requires Graphviz to be installed separately on your system (e.g., `brew install graphviz` on macOS, or download from graphviz.org). Python 3.9 or higher required.

Verify before relying

  • Whether typed-ast and pre-commit are truly runtime dependencies or development-only (they appear unusual in a diagram rendering library's runtime chain).
  • Performance characteristics when rendering large or complex architectures with many nodes and connections.

Package facts

License MIT (permissive)
Python support supports the current Python release (~=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 4 — graphviz, jinja2, typed-ast, pre-commit
Maintenance actively maintained — 265 days since the last release
Last repo commit
First released
Downloads 7,503,612/month — #1,733 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: diagrams-0.25.1-py3-none-any.whl

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9

Tags

cloud architecture diagram as codedraw system architecture pythonvisualize cloud infrastructureaws azure gcp diagram generatorinfrastructure diagram pythoncloud topology visualizationarchitecture diagram version control
infrastructure-as-codecloud-architecturevisualization

More Graphics packages