The 12 Patterns diagrams¶
In [1]:
Copied!
pip install eoap_cwlwrap
pip install eoap_cwlwrap
Requirement already satisfied: eoap_cwlwrap in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (0.16.0) Requirement already satisfied: click>=8.0 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from eoap_cwlwrap) (8.2.1) Requirement already satisfied: cwl-loader>=0.9.0 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from eoap_cwlwrap) (0.10.0) Requirement already satisfied: cwl-utils>=0.38 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from eoap_cwlwrap) (0.40) Requirement already satisfied: cwltool>=3.1.20250110105449 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from eoap_cwlwrap) (3.1.20250715140722) Requirement already satisfied: loguru in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from eoap_cwlwrap) (0.7.3) Requirement already satisfied: ruamel-yaml>=0.18.15 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from cwl-loader>=0.9.0->eoap_cwlwrap) (0.18.15) Requirement already satisfied: cwl-upgrader>=1.2.3 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from cwl-utils>=0.38->eoap_cwlwrap) (1.2.12) Requirement already satisfied: packaging in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from cwl-utils>=0.38->eoap_cwlwrap) (25.0) Requirement already satisfied: rdflib in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from cwl-utils>=0.38->eoap_cwlwrap) (7.1.4) Requirement already satisfied: requests in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from cwl-utils>=0.38->eoap_cwlwrap) (2.32.5) Requirement already satisfied: schema-salad<9,>=8.8.20250205075315 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from cwl-utils>=0.38->eoap_cwlwrap) (8.9.20250723145140) Requirement already satisfied: ruamel.yaml.clib>=0.2.7 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from ruamel-yaml>=0.18.15->cwl-loader>=0.9.0->eoap_cwlwrap) (0.2.14) Requirement already satisfied: mistune<3.1,>=3 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from schema-salad<9,>=8.8.20250205075315->cwl-utils>=0.38->eoap_cwlwrap) (3.0.2) Requirement already satisfied: CacheControl<0.15,>=0.13.1 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from CacheControl[filecache]<0.15,>=0.13.1->schema-salad<9,>=8.8.20250205075315->cwl-utils>=0.38->eoap_cwlwrap) (0.14.3) Requirement already satisfied: mypy_extensions in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from schema-salad<9,>=8.8.20250205075315->cwl-utils>=0.38->eoap_cwlwrap) (1.1.0) Requirement already satisfied: msgpack<2.0.0,>=0.5.2 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from CacheControl<0.15,>=0.13.1->CacheControl[filecache]<0.15,>=0.13.1->schema-salad<9,>=8.8.20250205075315->cwl-utils>=0.38->eoap_cwlwrap) (1.1.1) Requirement already satisfied: filelock>=3.8.0 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from CacheControl[filecache]<0.15,>=0.13.1->schema-salad<9,>=8.8.20250205075315->cwl-utils>=0.38->eoap_cwlwrap) (3.19.1) Requirement already satisfied: pyparsing<4,>=2.1.0 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from rdflib->cwl-utils>=0.38->eoap_cwlwrap) (3.2.5) Requirement already satisfied: setuptools in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from cwl-upgrader>=1.2.3->cwl-utils>=0.38->eoap_cwlwrap) (80.9.0) Requirement already satisfied: prov==1.5.1 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from cwltool>=3.1.20250110105449->eoap_cwlwrap) (1.5.1) Requirement already satisfied: psutil>=5.6.6 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from cwltool>=3.1.20250110105449->eoap_cwlwrap) (7.1.0) Requirement already satisfied: coloredlogs in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from cwltool>=3.1.20250110105449->eoap_cwlwrap) (15.0.1) Requirement already satisfied: pydot>=1.4.1 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from cwltool>=3.1.20250110105449->eoap_cwlwrap) (4.0.1) Requirement already satisfied: argcomplete>=1.12.0 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from cwltool>=3.1.20250110105449->eoap_cwlwrap) (3.6.2) Requirement already satisfied: spython>=0.3.0 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from cwltool>=3.1.20250110105449->eoap_cwlwrap) (0.3.14) Requirement already satisfied: rich-argparse in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from cwltool>=3.1.20250110105449->eoap_cwlwrap) (1.7.1) Requirement already satisfied: lxml in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from prov==1.5.1->cwltool>=3.1.20250110105449->eoap_cwlwrap) (6.0.2) Requirement already satisfied: networkx in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from prov==1.5.1->cwltool>=3.1.20250110105449->eoap_cwlwrap) (3.5) Requirement already satisfied: python-dateutil in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from prov==1.5.1->cwltool>=3.1.20250110105449->eoap_cwlwrap) (2.9.0.post0) Requirement already satisfied: six>=1.9.0 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from prov==1.5.1->cwltool>=3.1.20250110105449->eoap_cwlwrap) (1.17.0) Requirement already satisfied: charset_normalizer<4,>=2 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from requests->cwl-utils>=0.38->eoap_cwlwrap) (3.4.3) Requirement already satisfied: idna<4,>=2.5 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from requests->cwl-utils>=0.38->eoap_cwlwrap) (3.10) Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from requests->cwl-utils>=0.38->eoap_cwlwrap) (2.5.0) Requirement already satisfied: certifi>=2017.4.17 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from requests->cwl-utils>=0.38->eoap_cwlwrap) (2025.8.3)
Requirement already satisfied: humanfriendly>=9.1 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from coloredlogs->cwltool>=3.1.20250110105449->eoap_cwlwrap) (10.0) Requirement already satisfied: rich>=11.0.0 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from rich-argparse->cwltool>=3.1.20250110105449->eoap_cwlwrap) (14.1.0) Requirement already satisfied: markdown-it-py>=2.2.0 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from rich>=11.0.0->rich-argparse->cwltool>=3.1.20250110105449->eoap_cwlwrap) (4.0.0) Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from rich>=11.0.0->rich-argparse->cwltool>=3.1.20250110105449->eoap_cwlwrap) (2.19.2) Requirement already satisfied: mdurl~=0.1 in /opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/site-packages (from markdown-it-py>=2.2.0->rich>=11.0.0->rich-argparse->cwltool>=3.1.20250110105449->eoap_cwlwrap) (0.1.2)
Note: you may need to restart the kernel to use updated packages.
In [2]:
Copied!
from cwl2puml import (
to_puml,
DiagramType
)
from eoap_cwlwrap import wrap_locations
from io import (
StringIO,
BytesIO
)
from IPython.display import (
display_markdown,
display_png,
Markdown
)
from plantuml import deflate_and_encode
from PIL import Image
from typing import List
from urllib.request import urlopen
from loguru import logger
import sys
logger.remove() #remove the old handler. Else, the old one will work along with the new one you've added below'
logger.add(sys.stderr, level="CRITICAL")
base_url = 'https://raw.githubusercontent.com/eoap/application-package-patterns/refs/heads/main'
directory_stage_in = f"{base_url}/templates/stage-in.cwl"
file_stage_in = f"{base_url}/templates/stage-in-file.cwl"
stage_out_cwl = f"{base_url}/templates/stage-out.cwl"
debug = False
for pattern_index in range(1, 13, 1):
display_markdown(Markdown(f"# Pattern {pattern_index}"))
workflow_id = f"pattern-{pattern_index}"
workflows_cwl = f"{base_url}/cwl-workflow/{workflow_id}.cwl"
cwl_document = wrap_locations(
workflows=workflows_cwl,
workflow_id=workflow_id,
directory_stage_in=directory_stage_in,
file_stage_in=file_stage_in,
stage_out=stage_out_cwl
)
for diagram_type in DiagramType:
display_markdown(Markdown(f"## {diagram_type.name.lower()} diagram"))
out = StringIO()
to_puml( # workflow_id='main' by default
cwl_document=cwl_document,
diagram_type=diagram_type,
output_stream=out
)
clear_output = out.getvalue()
if debug:
print(clear_output)
encoded = deflate_and_encode(clear_output)
diagram_url = f"https://uml.planttext.com/plantuml/png/{encoded}"
with urlopen(diagram_url) as url:
img = Image.open(BytesIO(url.read()))
display_png(img)
from cwl2puml import (
to_puml,
DiagramType
)
from eoap_cwlwrap import wrap_locations
from io import (
StringIO,
BytesIO
)
from IPython.display import (
display_markdown,
display_png,
Markdown
)
from plantuml import deflate_and_encode
from PIL import Image
from typing import List
from urllib.request import urlopen
from loguru import logger
import sys
logger.remove() #remove the old handler. Else, the old one will work along with the new one you've added below'
logger.add(sys.stderr, level="CRITICAL")
base_url = 'https://raw.githubusercontent.com/eoap/application-package-patterns/refs/heads/main'
directory_stage_in = f"{base_url}/templates/stage-in.cwl"
file_stage_in = f"{base_url}/templates/stage-in-file.cwl"
stage_out_cwl = f"{base_url}/templates/stage-out.cwl"
debug = False
for pattern_index in range(1, 13, 1):
display_markdown(Markdown(f"# Pattern {pattern_index}"))
workflow_id = f"pattern-{pattern_index}"
workflows_cwl = f"{base_url}/cwl-workflow/{workflow_id}.cwl"
cwl_document = wrap_locations(
workflows=workflows_cwl,
workflow_id=workflow_id,
directory_stage_in=directory_stage_in,
file_stage_in=file_stage_in,
stage_out=stage_out_cwl
)
for diagram_type in DiagramType:
display_markdown(Markdown(f"## {diagram_type.name.lower()} diagram"))
out = StringIO()
to_puml( # workflow_id='main' by default
cwl_document=cwl_document,
diagram_type=diagram_type,
output_stream=out
)
clear_output = out.getvalue()
if debug:
print(clear_output)
encoded = deflate_and_encode(clear_output)
diagram_url = f"https://uml.planttext.com/plantuml/png/{encoded}"
with urlopen(diagram_url) as url:
img = Image.open(BytesIO(url.read()))
display_png(img)