System Context Diagram¶
c4.diagrams.system_context.SystemContextDiagram ¶
Bases: Diagram
Represents a C4 System Context Diagram.
Source code in c4/diagrams/system_context.py
12 13 14 15 | |
__init__ ¶
__init__(
title: str | None = None,
default_renderer: BaseRenderer[Diagram] | None = None,
) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str | None
|
Optional title to label the diagram. |
None
|
default_renderer
|
BaseRenderer[Diagram] | None
|
Optional default renderer to use for rendering. |
None
|
Source code in c4/diagrams/core.py
958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 | |
base_elements
property
¶
base_elements: list[BaseDiagramElement]
Returns a list of base elements of the diagram that should be rendered in a strict order.
relationships
property
¶
relationships: list[Relationship]
Returns all relationships defined in the diagram.
as_plantuml ¶
as_plantuml(**kwargs: Any) -> str
Render the diagram using the built-in PlantUML renderer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Optional keyword arguments passed to the renderer. |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
The rendered PlantUML code. |
Source code in c4/diagrams/core.py
1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 | |
render ¶
render(
renderer: BaseRenderer[Diagram] | None = None,
) -> str
Render the diagram to a string using the given or default renderer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
renderer
|
BaseRenderer[Diagram] | None
|
Optional renderer to override the default. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The rendered diagram output. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no renderer is provided and no default renderer is set. |
Source code in c4/diagrams/core.py
1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 | |
save ¶
save(
path: str | Path,
renderer: BaseRenderer[Diagram] | None = None,
) -> None
Render and save the diagram to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Target path to save the rendered output. |
required |
renderer
|
BaseRenderer[Diagram] | None
|
Optional renderer to override the default. |
None
|
Source code in c4/diagrams/core.py
1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 | |
save_as_plantuml ¶
save_as_plantuml(path: str | Path, **kwargs: Any) -> None
Render and save the diagram using the PlantUML renderer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Target file path. |
required |
**kwargs
|
Any
|
Optional kwargs passed to the PlantUML renderer. |
{}
|
Source code in c4/diagrams/core.py
1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 | |
c4.diagrams.system_context.SystemLandscapeDiagram ¶
Bases: Diagram
Represents a C4 System Landscape Diagram.
Source code in c4/diagrams/system_context.py
18 19 20 21 | |
__init__ ¶
__init__(
title: str | None = None,
default_renderer: BaseRenderer[Diagram] | None = None,
) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str | None
|
Optional title to label the diagram. |
None
|
default_renderer
|
BaseRenderer[Diagram] | None
|
Optional default renderer to use for rendering. |
None
|
Source code in c4/diagrams/core.py
958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 | |
base_elements
property
¶
base_elements: list[BaseDiagramElement]
Returns a list of base elements of the diagram that should be rendered in a strict order.
relationships
property
¶
relationships: list[Relationship]
Returns all relationships defined in the diagram.
as_plantuml ¶
as_plantuml(**kwargs: Any) -> str
Render the diagram using the built-in PlantUML renderer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Optional keyword arguments passed to the renderer. |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
The rendered PlantUML code. |
Source code in c4/diagrams/core.py
1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 | |
render ¶
render(
renderer: BaseRenderer[Diagram] | None = None,
) -> str
Render the diagram to a string using the given or default renderer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
renderer
|
BaseRenderer[Diagram] | None
|
Optional renderer to override the default. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The rendered diagram output. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no renderer is provided and no default renderer is set. |
Source code in c4/diagrams/core.py
1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 | |
save ¶
save(
path: str | Path,
renderer: BaseRenderer[Diagram] | None = None,
) -> None
Render and save the diagram to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Target path to save the rendered output. |
required |
renderer
|
BaseRenderer[Diagram] | None
|
Optional renderer to override the default. |
None
|
Source code in c4/diagrams/core.py
1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 | |
save_as_plantuml ¶
save_as_plantuml(path: str | Path, **kwargs: Any) -> None
Render and save the diagram using the PlantUML renderer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Target file path. |
required |
**kwargs
|
Any
|
Optional kwargs passed to the PlantUML renderer. |
{}
|
Source code in c4/diagrams/core.py
1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 | |
c4.diagrams.system_context.Person ¶
Bases: Element
Represents a person (actor) interacting with the system.
__init__ ¶
__init__(
label: str | Required = not_provided,
description: str = "",
sprite: str = "",
tags: str = "",
link: str = "",
type_: str = "",
alias: str | EmptyStr = empty,
) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | Required
|
Display name for the element. Required. |
not_provided
|
description
|
str
|
Optional description text. |
''
|
sprite
|
str
|
Optional sprite/icon reference for rendering. |
''
|
tags
|
str
|
Optional comma-separated tags for grouping/styling. |
''
|
link
|
str
|
Optional URL associated with the element. |
''
|
type_
|
str
|
Optional custom type or stereotype label. |
''
|
alias
|
str | EmptyStr
|
Unique identifier for the element. If not provided, it is autogenerated from the label. |
empty
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
c4.diagrams.system_context.PersonExt ¶
c4.diagrams.system_context.System ¶
Bases: Element
Represents a software system in the C4 model.
__init__ ¶
__init__(
label: str | Required = not_provided,
description: str = "",
sprite: str = "",
tags: str = "",
link: str = "",
type_: str = "",
base_shape: str = "",
alias: str | EmptyStr = empty,
) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | Required
|
Human-readable name. |
not_provided
|
description
|
str
|
Optional description for the system. |
''
|
sprite
|
str
|
Optional icon or sprite. |
''
|
tags
|
str
|
Comma-separated tags. |
''
|
link
|
str
|
Optional hyperlink associated with the element. |
''
|
type_
|
str
|
Custom type/stereotype string. |
''
|
base_shape
|
str
|
Optional override for visual shape. |
''
|
alias
|
str | EmptyStr
|
Unique identifier for the system. |
empty
|
c4.diagrams.system_context.SystemExt ¶
c4.diagrams.system_context.SystemDb ¶
c4.diagrams.system_context.SystemQueue ¶
c4.diagrams.system_context.SystemQueueExt ¶
c4.diagrams.system_context.SystemBoundary ¶
Bases: Boundary
Represents the boundary around a specific system.
Used to group containers or components that belong to a single system.
c4.diagrams.system_context.EnterpriseBoundary ¶
Bases: Boundary
Represents an enterprise boundary in a system landscape or context diagram.
Used to group systems and actors that belong to the same organizational unit.
__init__ ¶
__init__(
label: str | Required = not_provided,
description: str = "",
tags: str = "",
link: str = "",
alias: str | EmptyStr = empty,
) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | Required
|
Display name. |
not_provided
|
description
|
str
|
Optional description. |
''
|
tags
|
str
|
Optional comma-separated tags. |
''
|
link
|
str
|
Optional hyperlink. |
''
|
alias
|
str | EmptyStr
|
Unique identifier for the boundary. |
empty
|