Skip to content

Structurizr Views

Views are created on workspace.views. See the views guide.

c4.contrib.structurizr.Views

The ordered collection of views declared for a workspace.

SystemLandscapeView

SystemLandscapeView(
    *,
    title: str | None = None,
    key: str | None = None,
    description: str | None = None,
    include: ViewSelectorInput | None = None,
    exclude: ViewSelectorInput | None = None,
    tags: list[str] | tuple[str, ...] | None = None,
    properties: Mapping[str, Any] | None = None,
    auto_layout: AutoLayout | None = None,
    animation: ViewSelectorInput | None = None,
) -> SystemLandscapeView

Add an enterprise-wide system landscape view.

Parameters:

Name Type Description Default
title str | None

Optional title shown on the view.

None
key str | None

Optional stable Structurizr view key.

None
description str | None

Optional view description.

None
include ViewSelectorInput | None

Initial selectors to include.

None
exclude ViewSelectorInput | None

Initial selectors to exclude.

None
tags list[str] | tuple[str, ...] | None

Tags applied to the view.

None
properties Mapping[str, Any] | None

Custom view properties.

None
auto_layout AutoLayout | None

Optional automatic-layout configuration.

None
animation ViewSelectorInput | None

Ordered animation selector groups.

None

SystemContextView

SystemContextView(
    scope: SoftwareSystem,
    *,
    title: str | None = None,
    key: str | None = None,
    description: str | None = None,
    include: ViewSelectorInput | None = None,
    exclude: ViewSelectorInput | None = None,
    tags: list[str] | tuple[str, ...] | None = None,
    properties: Mapping[str, Any] | None = None,
    auto_layout: AutoLayout | None = None,
    animation: ViewSelectorInput | None = None,
) -> SystemContextView

Add a context view for a software system.

Parameters:

Name Type Description Default
scope SoftwareSystem

Software system shown as the view's focus.

required
title str | None

Optional title shown on the view.

None
key str | None

Optional stable Structurizr view key.

None
description str | None

Optional view description.

None
include ViewSelectorInput | None

Initial selectors to include.

None
exclude ViewSelectorInput | None

Initial selectors to exclude.

None
tags list[str] | tuple[str, ...] | None

Tags applied to the view.

None
properties Mapping[str, Any] | None

Custom view properties.

None
auto_layout AutoLayout | None

Optional automatic-layout configuration.

None
animation ViewSelectorInput | None

Ordered animation selector groups.

None

ContainerView

ContainerView(
    scope: SoftwareSystem,
    *,
    title: str | None = None,
    key: str | None = None,
    description: str | None = None,
    include: ViewSelectorInput | None = None,
    exclude: ViewSelectorInput | None = None,
    tags: list[str] | tuple[str, ...] | None = None,
    properties: Mapping[str, Any] | None = None,
    auto_layout: AutoLayout | None = None,
    animation: ViewSelectorInput | None = None,
) -> ContainerView

Add a container view for a software system.

Parameters:

Name Type Description Default
scope SoftwareSystem

Software system shown as the view's focus.

required
title str | None

Optional title shown on the view.

None
key str | None

Optional stable Structurizr view key.

None
description str | None

Optional view description.

None
include ViewSelectorInput | None

Initial selectors to include.

None
exclude ViewSelectorInput | None

Initial selectors to exclude.

None
tags list[str] | tuple[str, ...] | None

Tags applied to the view.

None
properties Mapping[str, Any] | None

Custom view properties.

None
auto_layout AutoLayout | None

Optional automatic-layout configuration.

None
animation ViewSelectorInput | None

Ordered animation selector groups.

None

ComponentView

ComponentView(
    scope: Container,
    *,
    title: str | None = None,
    key: str | None = None,
    description: str | None = None,
    include: ViewSelectorInput | None = None,
    exclude: ViewSelectorInput | None = None,
    tags: list[str] | tuple[str, ...] | None = None,
    properties: Mapping[str, Any] | None = None,
    auto_layout: AutoLayout | None = None,
    animation: ViewSelectorInput | None = None,
) -> ComponentView

Add a component view for a container.

Parameters:

Name Type Description Default
scope Container

Container shown as the view's focus.

required
title str | None

Optional title shown on the view.

None
key str | None

Optional stable Structurizr view key.

None
description str | None

Optional view description.

None
include ViewSelectorInput | None

Initial selectors to include.

None
exclude ViewSelectorInput | None

Initial selectors to exclude.

None
tags list[str] | tuple[str, ...] | None

Tags applied to the view.

None
properties Mapping[str, Any] | None

Custom view properties.

None
auto_layout AutoLayout | None

Optional automatic-layout configuration.

None
animation ViewSelectorInput | None

Ordered animation selector groups.

None

DynamicView

DynamicView(
    scope: StructurizrElement | None = None,
    *,
    title: str | None = None,
    key: str | None = None,
    description: str | None = None,
    include: ViewSelectorInput | None = None,
    exclude: ViewSelectorInput | None = None,
    tags: list[str] | tuple[str, ...] | None = None,
    properties: Mapping[str, Any] | None = None,
    auto_layout: AutoLayout | None = None,
    animation: ViewSelectorInput | None = None,
    steps: Iterable[Relationship | DynamicStep]
    | None = None,
) -> DynamicView

Add a dynamic view, optionally scoped to an element.

Parameters:

Name Type Description Default
scope StructurizrElement | None

Optional model element shown as the view's focus.

None
title str | None

Optional title shown on the view.

None
key str | None

Optional stable Structurizr view key.

None
description str | None

Optional view description.

None
include ViewSelectorInput | None

Initial selectors to include.

None
exclude ViewSelectorInput | None

Initial selectors to exclude.

None
tags list[str] | tuple[str, ...] | None

Tags applied to the view.

None
properties Mapping[str, Any] | None

Custom view properties.

None
auto_layout AutoLayout | None

Optional automatic-layout configuration.

None
animation ViewSelectorInput | None

Ordered animation selector groups.

None
steps Iterable[Relationship | DynamicStep] | None

Initial relationships or dynamic steps, in display order.

None

DeploymentView

DeploymentView(
    scope: StructurizrElement | None = None,
    *,
    environment: str,
    title: str | None = None,
    key: str | None = None,
    description: str | None = None,
    include: ViewSelectorInput | None = None,
    exclude: ViewSelectorInput | None = None,
    tags: list[str] | tuple[str, ...] | None = None,
    properties: Mapping[str, Any] | None = None,
    auto_layout: AutoLayout | None = None,
    animation: ViewSelectorInput | None = None,
) -> DeploymentView

Add a deployment view for an environment.

Parameters:

Name Type Description Default
scope StructurizrElement | None

Optional model element shown as the view's focus.

None
environment str

Deployment environment name to show.

required
title str | None

Optional title shown on the view.

None
key str | None

Optional stable Structurizr view key.

None
description str | None

Optional view description.

None
include ViewSelectorInput | None

Initial selectors to include.

None
exclude ViewSelectorInput | None

Initial selectors to exclude.

None
tags list[str] | tuple[str, ...] | None

Tags applied to the view.

None
properties Mapping[str, Any] | None

Custom view properties.

None
auto_layout AutoLayout | None

Optional automatic-layout configuration.

None
animation ViewSelectorInput | None

Ordered animation selector groups.

None

c4.contrib.structurizr.workspace.SystemLandscapeView

Bases: _WorkspaceView

A view showing the software systems in the enterprise landscape.

include

include(*values: Any) -> Self

Add selectors to include in this view.

Parameters:

Name Type Description Default
*values Any

Elements, selectors, or iterables of either to include.

()

exclude

exclude(*values: Any) -> Self

Add selectors to exclude from this view.

Parameters:

Name Type Description Default
*values Any

Elements, selectors, or iterables of either to exclude.

()

c4.contrib.structurizr.workspace.SystemContextView

Bases: _WorkspaceView

A view showing a software system and its direct context.

include

include(*values: Any) -> Self

Add selectors to include in this view.

Parameters:

Name Type Description Default
*values Any

Elements, selectors, or iterables of either to include.

()

exclude

exclude(*values: Any) -> Self

Add selectors to exclude from this view.

Parameters:

Name Type Description Default
*values Any

Elements, selectors, or iterables of either to exclude.

()

c4.contrib.structurizr.workspace.ContainerView

Bases: _WorkspaceView

A view showing the containers within a software system.

include

include(*values: Any) -> Self

Add selectors to include in this view.

Parameters:

Name Type Description Default
*values Any

Elements, selectors, or iterables of either to include.

()

exclude

exclude(*values: Any) -> Self

Add selectors to exclude from this view.

Parameters:

Name Type Description Default
*values Any

Elements, selectors, or iterables of either to exclude.

()

c4.contrib.structurizr.workspace.ComponentView

Bases: _WorkspaceView

A view showing the components within a container.

include

include(*values: Any) -> Self

Add selectors to include in this view.

Parameters:

Name Type Description Default
*values Any

Elements, selectors, or iterables of either to include.

()

exclude

exclude(*values: Any) -> Self

Add selectors to exclude from this view.

Parameters:

Name Type Description Default
*values Any

Elements, selectors, or iterables of either to exclude.

()

c4.contrib.structurizr.DynamicView

Bases: _WorkspaceView

A view showing an ordered sequence of interactions.

include

include(*values: Any) -> Self

Add selectors to include in this view.

Parameters:

Name Type Description Default
*values Any

Elements, selectors, or iterables of either to include.

()

exclude

exclude(*values: Any) -> Self

Add selectors to exclude from this view.

Parameters:

Name Type Description Default
*values Any

Elements, selectors, or iterables of either to exclude.

()

step

step(
    source: StructurizrElement,
    destination: StructurizrElement,
    description: str | None = None,
    *,
    technology: str | None = None,
    relationship: Relationship | None = None,
    create_relationship: bool = False,
    tags: list[str] | tuple[str, ...] | None = None,
    properties: Mapping[str, Any] | None = None,
    url: str | None = None,
    style: Mapping[str, Any] | None = None,
) -> DynamicStep

Append an interaction, optionally creating its model relationship.

Parameters:

Name Type Description Default
source StructurizrElement

Element that initiates the interaction.

required
destination StructurizrElement

Element that receives the interaction.

required
description str | None

Optional human-readable interaction label.

None
technology str | None

Optional technology used by the interaction.

None
relationship Relationship | None

Existing relationship represented by this step.

None
create_relationship bool

Whether to also register this interaction as a model relationship. Dynamic steps are view-local by default.

False
tags list[str] | tuple[str, ...] | None

Tags applied to the dynamic step or created relationship.

None
properties Mapping[str, Any] | None

Custom dynamic-step properties.

None
url str | None

Optional hyperlink associated with the step.

None
style Mapping[str, Any] | None

Step-local style properties.

None

c4.contrib.structurizr.workspace.DeploymentView

Bases: _WorkspaceView

A view showing a deployment environment and its infrastructure.

include

include(*values: Any) -> Self

Add selectors to include in this view.

Parameters:

Name Type Description Default
*values Any

Elements, selectors, or iterables of either to include.

()

exclude

exclude(*values: Any) -> Self

Add selectors to exclude from this view.

Parameters:

Name Type Description Default
*values Any

Elements, selectors, or iterables of either to exclude.

()

c4.contrib.structurizr.DynamicStep dataclass

One ordered interaction in a dynamic view.

Attributes:

Name Type Description
source StructurizrElement

Element that initiates the interaction.

destination StructurizrElement

Element that receives the interaction.

description str | None

Human-readable interaction label; None when the step comes from an unlabeled relationship.

technology str | None

Optional technology used by the interaction.

relationship Relationship | None

Optional model relationship represented by this step.

tags tuple[str, ...]

Tags applied to the step.

url str | None

Optional hyperlink associated with the step.

properties Mapping[str, Any] | None

Custom step properties.

style Mapping[str, Any] | None

Step-local style properties.

c4.contrib.structurizr.ViewTag

Bases: ViewSelector

Select view elements that carry a specific tag.

c4.contrib.structurizr.RawSelector dataclass

Bases: ViewSelector

A view selector expressed directly in Structurizr DSL syntax.

c4.contrib.structurizr.AutoLayout dataclass

Structurizr automatic layout settings.

Defaults to left-to-right ranking. implementation, rank_separation and node_separation are optional and omitted from the DSL when unset.

Attributes:

Name Type Description
rank_direction StructurizrRankDirection

Direction in which the layout ranks elements.

implementation str | None

Optional Structurizr layout implementation name.

rank_separation int | None

Optional positive gap between ranks.

node_separation int | None

Optional positive gap between nodes.