Skip to content

Module cwl_loader

The CWL Loader Python library is a helper library to simplify the parse and serialize operations of CWL documents to and from cwl-utils object models.

CWL Loader (c) 2025

CWL Loader is licensed under Creative Commons Attribution-ShareAlike 4.0 International.

You should have received a copy of the license along with this work. If not, see https://creativecommons.org/licenses/by-sa/4.0/.

Variables

ORIGINAL_CWLVERSION
Processes

A single CWL Process or a list of Processes union type.

Stream

A generic type to accept io.IOBase specializations only.

Functions

dump_cwl

def dump_cwl(
    process: ~Processes,
    stream: ~Stream
)

Serializes a CWL document to its YAML representation.

Parameters:

Name Type Description Default
process Processes The CWL Process or Processes (if the CWL document is a $graph) None
stream Stream The stream where serializing the CWL document None

Returns:

Type Description
None none.

load_cwl_from_location

def load_cwl_from_location(
    path: str,
    cwl_version: Optional[str] = 'v1.2'
) -> ~Processes

Loads a CWL document from a URL or a file on the local File System, automatically detected.

Parameters:

Name Type Description Default
path str The URL or a file on the local File System where reading the CWL document None
uri Optional[str] The CWL document URI. Default to io:// None
cwl_version Optional[str] The CWL document version. Default to v1.2 None

Returns:

Type Description
Processes The parsed CWL Process or Processes (if the CWL document is a $graph).

load_cwl_from_stream

def load_cwl_from_stream(
    content: ~Stream,
    uri: Optional[str] = 'io://',
    cwl_version: Optional[str] = 'v1.2'
) -> ~Processes

Loads a CWL document from a stream of data.

Parameters:

Name Type Description Default
content Stream The stream where reading the CWL document None
uri Optional[str] The CWL document URI. Default to io:// None
cwl_version Optional[str] The CWL document version. Default to v1.2 None

Returns:

Type Description
Processes The parsed CWL Process or Processes (if the CWL document is a $graph).

load_cwl_from_string_content

def load_cwl_from_string_content(
    content: str,
    uri: Optional[str] = 'io://',
    cwl_version: Optional[str] = 'v1.2'
) -> ~Processes

Loads a CWL document from its textual representation.

Parameters:

Name Type Description Default
content str The string text representing the CWL document None
uri Optional[str] The CWL document URI. Default to io:// None
cwl_version Optional[str] The CWL document version. Default to v1.2 None

Returns:

Type Description
Processes The parsed CWL Process or Processes (if the CWL document is a $graph)

load_cwl_from_yaml

def load_cwl_from_yaml(
    raw_process: dict,
    uri: Optional[str] = 'io://',
    cwl_version: Optional[str] = 'v1.2'
) -> ~Processes

Loads a CWL document from a raw dictionary.

Parameters:

Name Type Description Default
raw_process dict The dictionary representing the CWL document None
uri Optional[str] The CWL document URI. Default to io:// None
cwl_version Optional[str] The CWL document version. Default to v1.2 None

Returns:

Type Description
Processes The parsed CWL Process or Processes (if the CWL document is a $graph).