graph2cwl
Python module that interfaces with cwl-utils in order to generate cwl files.
Getting Started
pip install graph2cwl
Here is a code snippet :
from graph2cwl import WorkflowCreator
wf = WorkflowCreator(id="wf")
wf.add_step(id="step_1", run="./my_file.py")
wf.add_step(id="step_2", run="./my_file_2.py")
wf.add_dependency("step_1", "step_2", dep_name="step_1_out")
wf.add_workflow_input("input_1")
wf.add_workflow_output("output", outputSource="step_1/step_1_out")
wf.add_dependency("input_1", "step_2")
wf.add_dependency("input_1", "step_1")
wf.to_yaml("wf.yaml")
This creates the following valid cwl:
id: w
class: Workflow
inputs:
- id: input_1
type: File
outputs:
- id: output
outputSource: step_1/step_1_out
type: File
cwlVersion: v1.2
steps:
- id: step_1
in:
- id: xehsftvk
source: input_1
out:
- step_1_out
run: my_file.py
- id: step_2
in:
- id: fwfmzpkk
source: step_1/step_1_out
- id: ellhmrzg
source: input_1
out: []
run: my_file_2.py
which can be visualized (see cwl2nx):
• w/input_1
├─• w/step_1
│ ╰─• w/step_1/step_1_out
│ ├─• w/output
╰───┴─• w/step_2
Advanced usage
To embed the cwl with additionnal information, you must follow the cwl specification, implemented in cwl-utils. For example, to insert additional informations to a step, you can add the hints argument, or the extension_field one :
from graph2cwl import WorkflowCreator
wf = WorkflowCreator(id="w")
wf.add_step(id="step_1", run="./my_file.py", hints={"hint1": "value1"})
wf.add_step(id="step_2", run="./my_file_2.py")
wf.add_dependency("step_1", "step_2", dep_name="step_1_out")
wf.add_workflow_input("input_1", extension_fields={"label": "het"})
wf.add_workflow_output("output", outputSource="step_1/step_1_out")
wf.add_dependency("input_1", "step_2")
wf.add_dependency("input_1", "step_1")
wf.to_yaml("wf2.yaml")
See : https://cwl-utils.readthedocs.io/en/latest/autoapi/cwl_utils/parser/cwl_v1_2/index.html#cwl_utils.parser.cwl_v1_2.WorkflowStep for the list of supported arguments.
Metadata
Release files for graph2cwl 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| graph2cwl-0.0.3.tar.gz | 4.8 kB | Without provenance | Details for graph2cwl-0.0.3.tar.gz |
Release files / graph2cwl-0.0.3.tar.gz
| Download URL | graph2cwl-0.0.3.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a55826b1a5b245fbf3773701bdee15be0b10700d3940a9501d38506ab8acbdf3
|
|
BLAKE2b-256 checksum How to use checksums |
21570e951efa515da5f7bcfa215c5cf1f3a3203ca81dd993dbc9d609d5102896
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for graph2cwl 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.