I'm trying to use a Custom
Node Type in this python diagrams as code library (website/docs] & pypi link). Below is (a minimal reproduceable example snippet of) my code:
from diagrams import Diagram
from diagrams import Edge
from diagrams.custom import Custom
from diagrams.gcp.devtools import ContainerRegistry
from diagrams.gcp.ml import AIPlatform
with Diagram(name="my_diagram",
filename="diagrams/my_diagram_rec",
show=True,
):
# nodes
vertexai = AIPlatform("Vertex AI")
gcr = ContainerRegistry("Container Registry")
gitlab_repo = Custom("Git Repo", "./diagrams/resources/gitlablogo.png")
# diagram structure includind Edge attributes
gitlab_repo >> Edge(label="Code \nConfig.yml \nEnvironment.yml") >> gcr
gcr >> Edge(label="Docker Image") >> vertexai
vertexai >> Edge(label="launches \nspecified \nmachine-size")
And confirmation that the gitlablogo.png
file exists at the location I reference it at:
~/my-repo issue49-diagrams $ ls diagrams/resources ok py 17:24:23
gitlablogo.png
But when I run python diagrams/so_q_diagram.py
, the image that pops up doesn't show my custom icon (the gitlab logo):
ok this was annoying and feels like a bug but apparently including a filename
param in the with Diagram(...
statement causes the custom icon to disappear. Because, without changing the location of gitlablogo.png
, running the exact code above with one single change --commenting out filename="diagrams/my_diagram_rec",
-- now causes the diagram image to render as expected: