Python-CWLGen (Deprecated)¶
Warning
python-cwlgen
is now deprecated, please use cwl-utils >= 0.4.
Example migration:
from cwl_utils import parser_v1_0
# You could alias this as cwlgen to simplify the migration
from cwl_utils import parser_v1_0 as cwlgen
Migration notes:¶
Method changes
get_dict() → save()
parse_cwl(cwlfile)
→load_document(cwlfile)
parse_dict
→ No super clear analogue, but loaded through_RecordLoader(CommandLineTool)
||_UnionLoader((CommandLineToolLoader, ...workflow + other loaders)
Field names:
- Uses
camelCase
instead ofsnake_case
- No more special field names, eg:
-
tool_id
|workflow_id
|input_id
| etc →id
-StepInput
:inputs
→in_
- Uses
Other notes:
Classes aren’t nested anymore, ie:
cwlgen.InitialWorkDirRequirement.Dirent
→cwlutils
.Take care if you’re migrating to a newer spec, as some classes might have changed names (notably:
InputParameter
->WorkflowInputParameter
)Don’t forget to catch all references of cwlgen, as missing one (or using mismatch versions of the parser) will cause:
raise RepresenterError('cannot represent an object: %s' % (data,)) ruamel.yaml.representer.RepresenterError: cannot represent an object: <cwlgen.common.CommandInputArraySchema object at 0x1100a5780>
If you have issues with the migration, please see this thread or raise an issue on CWLUtils.
Python-cwlgen is a python library for the programmatic generation of CWL v1.0. It supports the generation of CommandLineTool and Workflows.
The library works for both Python 2.7.12+ and 3.6.0+.
Quick-start¶
You can install Python-CWLGen through pip with the following command:
pip install cwlgen
The classes very closely (if not exactly) mirror the CWL v1.0 specification. You can find more about their parameters in the following specifications:
cwlgen.CommandLineTool
cwlgen.Workflow