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 or FigJam nodes 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.
  • 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

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

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
  • CLI and the live UI
  • AI agent skills: spinagram skills install --agent claude|codex|cursor|gemini|copilot|… teaches your coding agent to write and style diagrams
  • 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

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).

Metadata

Release files for spinagram 0.1.2

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.1.2
File Size Uploaded
spinagram-0.1.2.tar.gz 1.7 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for spinagram 0.1.2
File Interpreter ABI Platform
spinagram-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 2.1 MB

Release files / spinagram-0.1.2.tar.gz

Download URL spinagram-0.1.2.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
3ead6e3b9a7f4863b4b0f0c7a3bbcdc2acc41a0b5bfd2b6bc15a1ce072b91a89
BLAKE2b-256 checksum
How to use checksums
07716cf32b40764216aea2613f24d69a8520cf4e905712a1765cede55481958b
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":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / spinagram-0.1.2-py3-none-any.whl

Download URL spinagram-0.1.2-py3-none-any.whl
Size 494.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6171bf9ab44b0d2cd5637b0d8467ab4f59ee8ae9c9433a1332796987f6b6fe7
BLAKE2b-256 checksum
How to use checksums
787d9d66d44a8844f3cdfc071a7dd08dac04954df3e92df26042a5238b112f20
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":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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