pystructurizr
A Python DSL inspired by Structurizr, intended for generating C4 diagrams
What it is and what it does
PyStructurizr is a Python library that lets you define C4 software architecture diagrams using Python code instead of Structurizr's custom DSL language. It translates Python model definitions—persons, software systems, containers, and their relationships—into diagrams that can be viewed, exported, or uploaded to cloud storage. The package includes a CLI with three main modes: dump (convert Python to Structurizr DSL), dev (live preview in a browser), and build (generate SVG and upload to cloud providers like google-cloud-storage or boto3).
The library's main appeal is that it lets you use Python's full expressiveness—imports, functions, loops, version control—to manage architecture diagrams as code, rather than dealing with a custom language's syntax and primitive file-inclusion mechanisms. It depends on watchdog for file monitoring, click for CLI commands, httpx for HTTP requests, and cloud storage SDKs for upload functionality. The package is in alpha status and has been dormant since mid-2023, so active development has stalled.
Use it for:
- Define C4 architecture diagrams in Python and export them to Structurizr DSL format for sharing or further editing
- Generate live previews of architecture diagrams while editing Python model code in a development workflow
- Convert Python-defined architecture models to SVG and automatically upload them to cloud storage for embedding in documentation
- Organize large architecture models using Python's import and module system instead of Structurizr DSL's limited file inclusion
- Version-control architecture diagrams as Python code alongside application source code for team collaboration
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PyStructurizr provides a Python DSL for defining C4 software architecture diagrams programmatically, with CLI tools to convert to Structurizr DSL, generate SVG output, and preview diagrams live in a browser.
Yes, if you need to define C4 diagrams programmatically and prefer Python over Structurizr DSL syntax. The low install friction and permissive license make it accessible. However, proceed with caution: the package is in alpha, dormant since 2023, and has no known vulnerabilities but also no recent maintenance. It's suitable for personal projects or teams comfortable maintaining a stalled dependency, but risky for production systems requiring active support.
Install
pystructurizr on PyPI
pip
pip install pystructurizruv
uv add pystructurizrpoetry
poetry add pystructurizrInstalling pystructurizr
Before you install
Low install friction with a pure-Python wheel and eight runtime dependencies including watchdog, click, httpx, and cloud storage libraries (google-cloud-storage, boto3). Maintenance is dormant—last release was 2023-07-27 and last commit 2024-03-06, though the repository remains active and unarchived.
License in practice
MIT license (permissive) means you can use, modify, and distribute this package freely with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install pystructurizr
from pystructurizr.dsl import Workspace
with Workspace() as workspace:
with workspace.Model(name="model") as model:
user = model.Person("User")
with model.SoftwareSystem("System") as sys:
app = sys.Container("App")
user.uses(app, "Uses")
Verify before relying
- Whether the package works reliably with Python versions beyond 3.8, given classifiers list only up to 3.8
- Current state of kroki.io integration and whether the online diagram rendering service remains stable
- Whether dormant maintenance status affects bug fixes or compatibility with recent Structurizr DSL changes
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 8 — watchdog, click, httpx, aiofiles, httpwatcher, google-cloud-storage, boto3, setuptools |
| Maintenance | dormant — 1,114 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 93,341/month — #13,391 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pystructurizr-0.1.3-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
diagramsDiagrams lets you draw cloud system…
permissive · top 5,000 on PyPI
seedirGenerates ASCII tree diagrams of folder…
permissive · top 15,000 on PyPI
torchvizGenerates visual diagrams of PyTorch neural…
permissive · top 5,000 on PyPI
schemdrawSchemdraw generates high-quality electrical…
permissive · top 15,000 on PyPI
sphinxcontrib-plantumlAdds PlantUML diagram rendering to Sphinx…
permissive · top 15,000 on PyPI
wavedromConverts WaveDrom-compatible JSON…
permissive · top 15,000 on PyPI
flydslFlyDSL is a Python DSL and embedded MLIR…
permissive · top 15,000 on PyPI
cytriangleCyTriangle wraps Jonathan Shewchuk's Triangle…
copyleft · top 15,000 on PyPI
plantumlGenerates UML diagrams from text markup by…
permissive · top 15,000 on PyPI
pictexPicTex generates high-quality PNG, JPEG, WebP,…
permissive · top 15,000 on PyPI