--- id: pystructurizr version: "0.1.3" license: MIT license_treatment: permissive maintenance: dormant --- # pystructurizr — A Python DSL inspired by Structurizr, intended for generating C4 diagrams License: permissive · Maintenance: dormant · Downloads: 93.3K/mo ## 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 above — 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 pip install pystructurizr uv add pystructurizr poetry add pystructurizr ## Installing 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: unspecified - Install friction: low - Maintenance: dormant - Downloads: 93.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags C4 diagram generation Python, architecture diagram as code, Structurizr Python DSL, software architecture visualization, diagram code to SVG, live diagram preview, cloud storage diagram upload, architecture-as-code, diagram-generation, c4-model [View on SkillFed](https://skillfed.io/packages/pystructurizr) · [View on PyPI](https://pypi.org/project/pystructurizr/)