Skip to main content

spinagram logo

spinagram

Diagrams as code, delivered editable everywhere.
Write a few lines of Python. Get SVG, PNG, PowerPoint with native shapes, and Figma, FigJam or Excalidraw scenes you can keep editing.

Documentation · Getting started · Python guide · Examples

CI Docs PyPI

One source: Python or YAML, rendered by spinagram to SVG, PNG, PowerPoint and Figma

Why spinagram

  • Editable output, not screenshots. PowerPoint slides get native shapes with the text inside and connectors bound to the boxes, so moving a box drags its arrows along. Figma gets real frames and nodes.
  • Python that reads like the picture. users >> lb >> api, groups as with blocks, loops and functions for the repetitive parts. YAML works too, for generated diagrams.
  • No coordinates needed. spinagram sizes every box from its text and icon, nests groups such as an AWS Region, a VPC and its zones, and places everything with one of four layout engines.
  • Brand once, render anywhere. A theme directory holds colours, fonts, styles, icons and page chrome.
  • Thousands of icons. AWS, GCP, Azure, Kubernetes, CNCF, OCI, OpenStack, Terrastruct, Devicon, SVG Logos, self-hosted and network packs download on first use. Add your own from a folder, npm or GitHub.
  • Edit with the mouse. spinagram serve has a canvas editor for YAML diagrams: drop icons and provider zones from a palette, drag, group and connect, and edit properties, while the YAML file stays the source of truth.
  • Built for reviews. spinagram check catches text overflow, spinagram serve previews live, and numbers can come from a facts file with their provenance in every render.

Quick start

pip install "spinagram[all]"            # or: uv add "spinagram[all]"

Say what is connected to what. spinagram sizes, places and styles everything:

from spinagram import Diagram

d = Diagram("Q01", "Web app on AWS", subtitle="No coordinates, laid out automatically")

users = d.box("Users", icon="aws:users")
with d.group("us-east-1", style="aws-region", direction="right"):
    with d.group("VPC", style="aws-vpc", direction="right"):
        lb = d.box("Load balancer", icon="aws:alb")
        api = d.box("API", text="FastAPI on ECS", icon="terrastruct:python")
        with d.group():  # no style: a light "soft" zone
            db = d.box("Orders DB", text="PostgreSQL", icon="terrastruct:postgres")
            cache = d.box("Cache", text="Redis", icon="terrastruct:redis")
    s3 = d.box("Uploads", text="S3 bucket", icon="aws:s3")

users.to(lb, "HTTPS") >> api
api.to(db, "SQL")
api >> [cache, s3]

d.save("out/", formats=["svg", "png", "pptx"])

Web app on AWS, laid out automatically

  • d.box(...) adds a node; its size comes from its text and icon. No coordinates needed.
  • a >> b draws an arrow, a.to(b, "label") a labelled one, a >> [b, c] fans out.
  • with d.group(...) nests nodes in a zone (an AWS Region, a VPC, or any style from your theme).
  • d.save() writes the files; in Jupyter the diagram shows inline. spinagram serve file.py previews it live.
The same diagram in YAML
id: Q01
title: Web app on AWS
subtitle: No coordinates, laid out automatically
groups:
  - id: region
    label: us-east-1
    style: aws-region
    direction: right
    children:
      - id: vpc
        label: VPC
        style: aws-vpc
        direction: right
        children: [lb, api, data]
      - s3
  - {id: data, children: [db, cache]}
nodes:
  - {id: users, title: Users, icon: "aws:users"}
  - {id: lb, title: Load balancer, icon: "aws:alb"}
  - {id: api, title: API, text: FastAPI on ECS, icon: "terrastruct:python"}
  - {id: db, title: Orders DB, text: PostgreSQL, icon: "terrastruct:postgres"}
  - {id: cache, title: Cache, text: Redis, icon: "terrastruct:redis"}
  - {id: s3, title: Uploads, text: S3 bucket, icon: "aws:s3"}
edges:
  - "users -> lb: HTTPS"
  - lb -> api
  - "api -> db: SQL"
  - api -> cache
  - api -> s3
spinagram render examples/quickstart.yaml -f svg,png,pptx -o out/

Need pixel-exact slides instead? Give nodes coordinates (manual layout), or freeze an automatic layout with spinagram layout spec.py -o frozen.yaml and tune it by hand.

Flowcharts, state machines, activities and CSS

Flowchart, StateMachine and Activity builders add the symbols and verbs of behavior diagrams (decisions, forks and joins, swimlanes, composite states) laid out by a built-in layered engine, and with d.state_machine(...) puts one inside any diagram. A CSS subset styles everything: d.stylesheet("brand.css"), class_="critical", edge.async { stroke-dasharray: 6 4 }. spinagram check --styles explains which rule set each value, spinagram serve has a click-to-inspect styles panel and re-renders when a stylesheet is saved. See behavior diagrams, CSS styling and CSS by backend (what SVG, PowerPoint and Figma do with each property). examples/showcase has AWS, Kubernetes and Google Cloud reference architectures styled only with CSS.

Order fulfilment activity with swimlanes

Homelab diagrams

The r/homelab network diagram from an inventory: folder-tab device cards, switch ports with VLAN ticks, cables as thick as their link speed, servers with their hardware, guests, storage pools and VLAN zones, and flow panels. Describe the lab in a type: homelab YAML file (or with the Homelab verbs in Python) and spinagram places every card, port and cable, dark by default or with -t homelab-light. redact: hides the real domain and SSIDs for a public post, and -f html writes a single page with pan, zoom, clickable hostnames and a service search.

spinagram render examples/homelab/reference.yaml -f svg,png,html

The design follows Goblinmine/homelab-diagram (MIT), whose example lab is examples/homelab/reference.yaml. See homelab diagrams.

A homelab diagram drawn from an inventory

Slides (preview)

Presentations written as React + TSX, rendered natively (no browser, no Node): oxc compiles the TSX, React runs in an embedded JS engine under a deterministic clock, and a Rust layout engine produces slides that export to a PowerPoint whose text, shapes, tables and charts are native and editable.

spinagram deck new my-deck          # deck.tsx, slides/*.tsx, data/ (neutral example content)
spinagram deck check my-deck        # overlaps, off-slide elements, unsupported CSS, missing data ids; exit 1 on errors
spinagram deck build my-deck -f pptx   # or -f svg (one file per slide) / -f json (the slide IR)

Every number comes from a source declared in deck.tsx (fact("id"), csv("name"), json("name")); a missing id fails the build and the speaker notes list where each number came from. See slide-decks/basic and .specs/features/slides/. spinagram deck deck.yaml keeps building the diagram HTML deck.

Outputs

Format What you get
svg Self-contained SVG with fonts and images embedded
png 2x PNG rendered from the SVG
pptx One slide per diagram with native shapes, bound connectors and native tables
figma Figma Plugin-API scripts that build native, editable nodes
figjam A FigJam board with connectors bound to the boxes
excalidraw An editable Excalidraw scene: native shapes, arrows bound to the boxes, embedded icons
html One self-contained page: the SVG with pan, zoom and clickable links (a service search for homelab diagrams)

Learn more

The documentation (searchable) covers:

  • Automatic layout: groups and the flex, dot, elk and d2 engines
  • Icon packs (AWS, Google Cloud, Azure, Kubernetes, CNCF projects, AI, about 2,000 technology logos, languages, self-hosted and network gear) and themes
  • Annotations: legends, numbered steps, callouts and designed notes
  • Facts: numbers with traceable sources
  • Figma and FigJam hand-off, and Excalidraw scenes
  • CLI, the live UI and its canvas editor
  • Edit API: patch a diagram's YAML from Python with the canvas's edit operations
  • AI agent skills: spinagram skills install --agent claude|codex|cursor|gemini|copilot|… teaches your coding agent to write and style diagrams
  • MCP server: spinagram mcp install -a claude|codex|cursor|gemini|copilot|opencode lets any MCP agent render, check and preview diagrams without a shell
  • Release notes: what's new in each version
  • Extending with your own backends and layout engines

Development

uv sync --all-extras && uv run pytest
cd docs && bun install && bun run dev  # docs at http://localhost:3000

uv sync builds the Rust engine in rust/, so it needs a Rust toolchain. See Development for the UI frontend, docs and releases.

Changelog and license

See CHANGELOG.md for what changed in each release. spinagram is released under the MIT License. Icon packs are downloaded from their upstream projects on first use and keep their own licenses (listed by spinagram icons list).

Credits

The homelab diagram type is based on Goblinmine/homelab-diagram by Goblinmine (MIT). Its design, palette, example lab and glyph icons are used under that license, which ships at src/spinagram/themes/homelab/icons/LICENSE. The light mode and the HTML page follow that project's open pull requests #4 by 01Petard and #6 by trapplab.

Metadata

Release files for spinagram 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spinagram 0.7.0
File Size Uploaded Provenance Actions
spinagram-0.7.0.tar.gz 4.3 MB Without provenance Details for spinagram-0.7.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for spinagram 0.7.0
File Actions
spinagram-0.7.0-cp311-abi3-win_arm64.whl CPython 3.11 abi3 Windows ARM64 Details for spinagram-0.7.0-cp311-abi3-win_arm64.whl
spinagram-0.7.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for spinagram-0.7.0-cp311-abi3-win_amd64.whl
spinagram-0.7.0-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details for spinagram-0.7.0-cp311-abi3-musllinux_1_2_x86_64.whl
spinagram-0.7.0-cp311-abi3-musllinux_1_2_aarch64.whl CPython 3.11 abi3 Linux musl 1.2+ ARM64 Details for spinagram-0.7.0-cp311-abi3-musllinux_1_2_aarch64.whl
spinagram-0.7.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for spinagram-0.7.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
spinagram-0.7.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for spinagram-0.7.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
spinagram-0.7.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for spinagram-0.7.0-cp311-abi3-macosx_11_0_arm64.whl
spinagram-0.7.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for spinagram-0.7.0-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 133.7 MB

Release files / spinagram-0.7.0.tar.gz

Download URL spinagram-0.7.0.tar.gz
Size 4.3 MB
Tags Source
SHA-256 checksum
How to use checksums
9ca72b2f82978c512cee88d1770dfb11cede1ed1eb29fbe9d326827da7c43283
BLAKE2b-256 checksum
How to use checksums
e94b3606b5cb7e278abf05adb95fc8e84b8ce6102be1a19f20560848fb611e1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / spinagram-0.7.0-cp311-abi3-win_arm64.whl

Download URL spinagram-0.7.0-cp311-abi3-win_arm64.whl
Size 15.4 MB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
8bd131e20bf5f0cd825834d99471afc0120d7c7ce246c55e76949f3df3bdc64d
BLAKE2b-256 checksum
How to use checksums
987b6800a22cbebe2829adc5e8608950abcfc655279885dfe2b7da8bb5008639
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / spinagram-0.7.0-cp311-abi3-win_amd64.whl

Download URL spinagram-0.7.0-cp311-abi3-win_amd64.whl
Size 16.2 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
8c10e0981b24093c07c404c948542d8a948755940d4b44a32ce87f96bcdedc1e
BLAKE2b-256 checksum
How to use checksums
e6aa3d7da6fccc97d9054383722771e2c96683c7cf8f4a2f83c751f8a87750e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / spinagram-0.7.0-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL spinagram-0.7.0-cp311-abi3-musllinux_1_2_x86_64.whl
Size 17.0 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
72a07cd083cc06f1b9bd4fbc62d8a2c9aaa9820a63a304dd80ddf3cff5a2d56d
BLAKE2b-256 checksum
How to use checksums
30976ac345ccf8b9edf995c84f1dec82e8b7c5564bae1fcf43718e25e243dd38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / spinagram-0.7.0-cp311-abi3-musllinux_1_2_aarch64.whl

Download URL spinagram-0.7.0-cp311-abi3-musllinux_1_2_aarch64.whl
Size 16.4 MB
Tags CPython 3.11 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
8e263356affd7884bf54c165a6024abf6bd24bc0d3aab9167caac5f3b4672b3d
BLAKE2b-256 checksum
How to use checksums
4aeb8da1b06cf9d72df22021e497abf10612db741ea48b9d580d75db785ccd7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / spinagram-0.7.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL spinagram-0.7.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 16.6 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
b46060f133c8aacb6fa2f085d492ec40fac9fb5abf3be81135570402b6beea32
BLAKE2b-256 checksum
How to use checksums
df9732380f4d3a19ef06057adc7857a9fbe4271ce816a5bd3fa57573cb5ddfc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / spinagram-0.7.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL spinagram-0.7.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 16.2 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
91e85c47ff0ff9a5b221d74ff96807331ff8851084957470800c09a50317b696
BLAKE2b-256 checksum
How to use checksums
f1962f5af242f8c26c68cd35704ed2aeec854ec8d68018973caa895967fed974
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / spinagram-0.7.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL spinagram-0.7.0-cp311-abi3-macosx_11_0_arm64.whl
Size 15.5 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bf69ec0447fa03554f5b662ab6cfcd1ab174a6b6698ed39bca25f66da9ba9d18
BLAKE2b-256 checksum
How to use checksums
0079b9f6e236bce401eacf4b5f6aa22fc23c917f86e8eac7b74552a6080b9b69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / spinagram-0.7.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL spinagram-0.7.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 16.2 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
22d59290a29c36d9db23d7b779425809ac252fea258728aaf5e90525fbe86c79
BLAKE2b-256 checksum
How to use checksums
4ef7e559032d50e2bb959e6b26c185f0953bbc64519a721169513be55b7002b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for spinagram 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page