diff --git a/CHANGELOG.md b/CHANGELOG.md index e75fcae..0404c45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [0.1.2] - (2026-03-15) + +### New Features + +- **Demo module**: Built-in `demo_archimate()` function that creates a pre-populated ArchiMate widget with a sample enterprise architecture model (12 elements across Business, Application, and Technology layers) — no external files needed + ## [0.1.1] - (2026-03-15) ### New Features diff --git a/src/anywidget_archimate/__init__.py b/src/anywidget_archimate/__init__.py index 7394a96..90b69cf 100644 --- a/src/anywidget_archimate/__init__.py +++ b/src/anywidget_archimate/__init__.py @@ -1,3 +1,5 @@ from anywidget_archimate.widget import ArchiMate __all__ = ["ArchiMate"] + +# demo_archimate is importable via anywidget_archimate.demo diff --git a/src/anywidget_archimate/demo.py b/src/anywidget_archimate/demo.py new file mode 100644 index 0000000..5829925 --- /dev/null +++ b/src/anywidget_archimate/demo.py @@ -0,0 +1,129 @@ +"""Demo module for anywidget-archimate. + +Creates a pre-populated ArchiMate widget with a sample enterprise +architecture model spanning Business, Application, and Technology layers. +Renders immediately without any external files. + +Usage: + from anywidget_archimate.demo import demo_archimate + widget = demo_archimate() +""" + +from __future__ import annotations + +from typing import Any + +from anywidget_archimate.widget import ArchiMate + +# Sample ArchiMate Open Exchange Format XML: a web shop with order processing, +# REST API, database service, and Kubernetes infrastructure. +DEMO_XML = """\ + + + Demo ArchiMate Model + + + + Customer + External customer interacting with the system + + + Order Processing + End-to-end order processing workflow + + + Payment Handling + Capability for processing payments + + + Order + A purchase order from a customer + + + + + Web Shop + Online storefront application + + + REST API + Public HTTP REST interface + + + Order Service + Manages order lifecycle + + + Order Record + Persistent order data + + + + + K8s Cluster + Kubernetes cluster hosting the application + + + PostgreSQL + Relational database for persistence + + + Database Service + Managed database service + + + App Server + Physical server hardware + + + + + + + + + + + + + + + + + +""" + + +def demo_archimate(**kwargs: Any) -> ArchiMate: + """Create a demo ArchiMate widget with a sample enterprise architecture model. + + The model contains 12 elements across three layers (Business, Application, + Technology) connected by 12 relationships, representing a web shop with + order processing, a REST API, and Kubernetes infrastructure. + + Parameters + ---------- + **kwargs + Additional keyword arguments passed to ArchiMate constructor. + Overrides demo defaults. + + Returns + ------- + ArchiMate + A ready-to-use ArchiMate widget with the demo model rendered. + + Example + ------- + >>> from anywidget_archimate.demo import demo_archimate + >>> widget = demo_archimate() + >>> widget # renders in notebook + """ + defaults: dict[str, Any] = { + "height": kwargs.pop("height", 700), + } + defaults.update(kwargs) + + return ArchiMate.from_xml(DEMO_XML, **defaults)