@@ -14,68 +14,60 @@ The library works for both Python 2.7.12+ and 3.6.0.
14
14
------------------------
15
15
16
16
17
-
18
- I've forked this repository to try and get my use of this repository working quickly without
19
- worrying too much about proper code etiquette. I have and will continue to submit merge requests
20
- back to the [ original repository] ( https://github.com/common-workflow-language/python-cwlgen ) .
21
-
22
- [ ![ Build Status] ( https://travis-ci.org/illusional/python-cwlgen.svg?branch=master )] ( https://travis-ci.org/common-workflow-language/python-cwlgen )
23
- [ ![ codecov] ( https://codecov.io/gh/illusional/python-cwlgen/branch/master/graph/badge.svg )] ( https://codecov.io/gh/illusional/python-cwlgen )
24
- [ ![ PyPI version] ( https://badge.fury.io/py/illusional.cwlgen.svg )] ( https://badge.fury.io/py/illusional.cwlgen )
25
-
26
17
# Common Workflow Language
27
18
28
- [ Common Workflow Language (CWL)] ( https://www.commonwl.org/v1.0/index.html ) is a method to describe workflows,
29
- and any tools (software) that it may use. The [ user guide] ( http://www.commonwl.org/user_guide/01-introduction/index.html )
30
- gives a gentle (and better) explanation of what its goals are, and how they are achieved , but broadly:
19
+ [ Common Workflow Language (CWL)] ( https://www.commonwl.org/v1.0/index.html ) is a language to describe workflows.
20
+ The [ user guide] ( http://www.commonwl.org/user_guide/01-introduction/index.html )
21
+ gives a gentle explanation of what its goals are, but broadly:
31
22
32
23
1 . Stop writing bash scripts for long complex jobs.
33
24
2 . Take pipelines anywhere (portability).
34
- 3 . Try to enforce reproducibility guidelines.
25
+ 3 . Enforce reproducibility guidelines.
35
26
36
- This python repository is simply a python wrapper for _ most_ of the classes (work in progress),
27
+ This python repository is a python wrapper for _ most_ of the classes (work in progress),
37
28
allowing you to build the structure of the workflow in Python and have this module generate and export CWL for you.
38
29
39
30
** Nb:** This isn't going to sanity or quality check Workflows or CommandLineTools for you, use
40
31
[ CWLTool] ( https://github.com/common-workflow-language/cwltool ) or [ WOMTool] ( https://cromwell.readthedocs.io/en/develop/WOMtool/ ) for that.
41
32
42
33
## Quick-start guide
43
34
44
- This is available through PIP!
35
+ You can install python-cwlgen through pip with the following command:
45
36
46
37
```
47
- pip install illusional. cwlgen
38
+ pip install cwlgen
48
39
```
49
40
50
41
## How it works ?
51
42
52
43
There's a pretty close copy of the cwl specifications ([ Workflow] ( https://www.commonwl.org/v1.0/Workflow.html ) |
53
44
[ CommandLineTool] ( https://www.commonwl.org/v1.0/CommandLineTool.html ) ), where the Python classes mirror the CWL spec.
54
- This repository also includes some of the docstrings to give you context of classes and their properties.
55
-
56
- I've tried to include direct links to a classes documentation, however this isn't always possible.
45
+ This repository also includes docstrings to give you context of classes and their properties.
57
46
58
- There are some small examples in the ` examples/ ` folder, however for whatever class you need, you simply just init
59
- that class, for example:
47
+ The ` examples/ ` folder contains some simple examples, however ,
48
+ you can simply initialise that class, for example:
60
49
61
50
_ Creating a CommandLineTool_
62
51
``` python
63
- # if using gitsubmodules, you can use the following import statement
64
- import cwlgen as cwl
52
+ import cwlgen
65
53
66
- tool_object = cwl .CommandLineTool(cwltool_id = " echo-tool" , base_command = " echo" , label = None , doc = None ,
54
+ tool_object = cwlgen .CommandLineTool(tool_id = " echo-tool" , base_command = " echo" , label = None , doc = None ,
67
55
cwl_version = " v1.0" , stdin = None , stderr = None , stdout = None , path = None )
68
- tool_object.inputs.append(cwl.CommandInputParameter( " myParamId " , label = None , secondary_files = None , param_format = None ,
69
- streamable = None , doc = None , input_binding = None , default = None , param_type = None ))
70
-
71
- # fill in the fields as required
56
+ tool_object.inputs.append(
57
+ cwlgen.CommandInputParameter( " myParamId " , param_type = " string " , label = None , secondary_files = None , param_format = None ,
58
+ streamable = None , doc = None , input_binding = None , default = None )
59
+ )
72
60
73
61
# to get the dictionary representation:
74
62
dict_to_export = tool_object.get_dict()
75
63
76
- # dump using a yaml exporter
77
- yaml.dump(dict_to_export)
78
- ```
64
+ # to get the string representation (YAML)
65
+ yaml_export = tool_object.export_string()
66
+
67
+ # print to console
68
+ tool_object.export()
79
69
80
- All of the classes should work in a similar way. I've removed the ` literal ` representation from my fork as I
81
- didn't want to use _ ruamel_ at the moment. Otherwise file an issue and I'll have a look into it.
70
+ # print to file
71
+ with open (" echotool.cwl" , " w" ) as f:
72
+ tool_object.export(f)
73
+ ```
0 commit comments