|
1 | | -# cwl-utils |
2 | | - |
3 | | -A collection of scripts to demonstrate the use of the new Python classes for |
4 | | -loading and parsing [CWL v1.0 ](https://github.com/common-workflow-language/cwl-utils/blob/main/cwl_utils/parser/v1_0.py), |
5 | | - [CWL v1.1](https://github.com/common-workflow-language/cwl-utils/blob/main/cwl_utils/parser/v1_1.py), |
6 | | -and [CWL v1.2](https://github.com/common-workflow-language/cwl-utils/blob/main/cwl_utils/parser/v1_2.py) |
| 1 | +|Linux Build Status| |Code coverage| |Documentation Status| |
| 2 | + |
| 3 | +.. |Linux Build Status| image:: https://github.com/common-workflow-language/cwl-utils/actions/workflows/ci-tests.yml/badge.svg?branch=main |
| 4 | + :target: https://github.com/common-workflow-language/cwl-utils/actions/workflows/ci-tests.yml |
| 5 | +.. |Code coverage| image:: https://codecov.io/gh/common-workflow-language/cwl-utils/branch/main/graph/badge.svg |
| 6 | + :target: https://codecov.io/gh/common-workflow-language/cwl-utils |
| 7 | +.. |Documentation Status| image:: https://readthedocs.org/projects/cwl-utils/badge/?version=latest |
| 8 | + :target: https://cwl-utils.readthedocs.io/en/latest/?badge=latest |
| 9 | + :alt: Documentation Status |
| 10 | + |
| 11 | +cwl-utils |
| 12 | +--------- |
| 13 | + |
| 14 | +A collection of scripts to demonstrate the use of the new Python classes |
| 15 | +for loading and parsing `CWL |
| 16 | +v1.0 <https://github.com/common-workflow-language/cwl-utils/blob/main/cwl_utils/parser/v1_0.py>`__, |
| 17 | +`CWL |
| 18 | +v1.1 <https://github.com/common-workflow-language/cwl-utils/blob/main/cwl_utils/parser/v1_1.py>`__, |
| 19 | +and `CWL |
| 20 | +v1.2 <https://github.com/common-workflow-language/cwl-utils/blob/main/cwl_utils/parser/v1_2.py>`__ |
7 | 21 | documents. |
8 | 22 |
|
9 | | -## Install |
10 | | - |
11 | 23 | Requires Python 3.6+ |
12 | 24 |
|
13 | | -``` bash |
14 | | -virtualenv -p python3.6 venv3.6 # Python 3.7, 3.8, or 3.9 would also work |
15 | | -source venv3.6/bin/activate |
16 | | -pip install cwl-utils |
17 | | -``` |
18 | | -or install the latest development version of `cwl-utils` |
| 25 | +Installation |
| 26 | +------------ |
| 27 | + |
| 28 | +:: |
| 29 | + |
| 30 | + pip3 install cwl-utils |
19 | 31 |
|
20 | | -``` bash |
21 | | -git clone https://github.com/common-workflow-language/cwl-utils.git |
22 | | -cd cwl-utils |
23 | | -virtualenv -p python3.6 venv3.6 # Python 3.7, 3.8, or 3.9 would also work |
24 | | -source venv3.6/bin/activate |
25 | | -pip install . |
26 | | -``` |
27 | | -(If you want to edit the sources from the development version, then run |
28 | | -`pip install -e .`) |
| 32 | +To install from source:: |
29 | 33 |
|
30 | | -## Usage |
| 34 | + git clone https://github.com/common-workflow-language/cwl-utils.git |
| 35 | + cd cwl-utils |
| 36 | + pip3 install . |
31 | 37 |
|
32 | | -### Pull the all referenced software container images |
| 38 | +Usage |
| 39 | +----- |
33 | 40 |
|
34 | | -`docker_extract.py` is useful to cache or pre-pull all software container images |
35 | | -referenced in a CWL CommandLineTool or CWL Workflow (including all referenced |
36 | | -CommandLineTools and sub-Workflows and so on). |
| 41 | +Pull the all referenced software container images |
| 42 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
37 | 43 |
|
38 | | -The default behaviour is to use the Docker engine to download and save the software |
39 | | -container images in Docker format. |
| 44 | +``docker_extract.py`` is useful to cache or pre-pull all software |
| 45 | +container images referenced in a CWL CommandLineTool or CWL Workflow |
| 46 | +(including all referenced CommandLineTools and sub-Workflows and so on). |
40 | 47 |
|
41 | | -```bash |
42 | | -docker_extract.py DIRECTORY path_to_my_workflow.cwl |
43 | | -``` |
| 48 | +The default behaviour is to use the Docker engine to download and save |
| 49 | +the software container images in Docker format. |
44 | 50 |
|
45 | | -Or you can use the Singularity software container engine to download and save the |
46 | | -software container images and convert them to the Singularity format at the same |
47 | | -time. |
| 51 | +.. code:: bash |
48 | 52 |
|
49 | | -```bash |
50 | | -docker_extract.py --singularity DIRECTORY path_to_my_workflow.cwl |
51 | | -``` |
| 53 | + docker_extract.py DIRECTORY path_to_my_workflow.cwl |
52 | 54 |
|
53 | | -### Using the CWL Parsers |
| 55 | +Or you can use the Singularity software container engine to download and |
| 56 | +save the software container images and convert them to the Singularity |
| 57 | +format at the same time. |
54 | 58 |
|
55 | | -[//]: # "Please keep the below synchronized with load_cwl_by_path.py" |
56 | | -```python |
57 | | -from pathlib import Path |
58 | | -from ruamel import yaml |
59 | | -import sys |
| 59 | +.. code:: bash |
60 | 60 |
|
61 | | -from cwl_utils.parser import load_document_by_path, save |
| 61 | + docker_extract.py --singularity DIRECTORY path_to_my_workflow.cwl |
62 | 62 |
|
63 | | -# File Input - This is the only thing you will need to adjust or take in as an input to your function: |
64 | | -cwl_file = Path("testdata/md5sum.cwl") # or a plain string works as well |
| 63 | +Using the CWL Parsers |
| 64 | +~~~~~~~~~~~~~~~~~~~~~ |
65 | 65 |
|
66 | | -# Import CWL Object |
67 | | -cwl_obj = load_document_by_path(cwl_file) |
| 66 | +.. code:: python |
68 | 67 |
|
69 | | -# View CWL Object |
70 | | -print("List of object attributes:\n{}".format("\n".join(map(str, dir(cwl_obj))))) |
| 68 | + from pathlib import Path |
| 69 | + from ruamel import yaml |
| 70 | + import sys |
71 | 71 |
|
72 | | -# Export CWL Object into a built-in typed object |
73 | | -saved_obj = save(cwl_obj) |
74 | | -print(f"Export of the loaded CWL object: {saved_obj}.") |
75 | | -``` |
| 72 | + from cwl_utils.parser import load_document_by_path, save |
76 | 73 |
|
77 | | -## Development |
| 74 | + # File Input - This is the only thing you will need to adjust or take in as an input to your function: |
| 75 | + cwl_file = Path("testdata/md5sum.cwl") # or a plain string works as well |
78 | 76 |
|
79 | | -### Regenerate parsers |
| 77 | + # Import CWL Object |
| 78 | + cwl_obj = load_document_by_path(cwl_file) |
80 | 79 |
|
81 | | -To regenerate install the `schema_salad` package and run: |
| 80 | + # View CWL Object |
| 81 | + print("List of object attributes:\n{}".format("\n".join(map(str, dir(cwl_obj))))) |
82 | 82 |
|
83 | | -`cwl_utils/parser/cwl_v1_0.py` was created via |
84 | | -`schema-salad-tool --codegen python https://github.com/common-workflow-language/common-workflow-language/raw/main/v1.0/CommonWorkflowLanguage.yml` |
| 83 | + # Export CWL Object into a built-in typed object |
| 84 | + saved_obj = save(cwl_obj) |
| 85 | + print(f"Export of the loaded CWL object: {saved_obj}.") |
85 | 86 |
|
86 | | -`cwl_utils/parser/cwl_v1_1.py` was created via |
87 | | -`schema-salad-tool --codegen python https://github.com/common-workflow-language/cwl-v1.1/raw/main/CommonWorkflowLanguage.yml` |
| 87 | +Development |
| 88 | +----------- |
88 | 89 |
|
89 | | -`cwl_utils/parser/cwl_v1_2.py` was created via |
90 | | -`schema-salad-tool --codegen python https://github.com/common-workflow-language/cwl-v1.2/raw/1.2.1_proposed/CommonWorkflowLanguage.yml` |
| 90 | +Regenerate parsers |
| 91 | +~~~~~~~~~~~~~~~~~~ |
91 | 92 |
|
| 93 | +To regenerate install the ``schema_salad`` package and run: |
92 | 94 |
|
93 | | -### Release |
| 95 | +``cwl_utils/parser/cwl_v1_0.py`` was created via |
| 96 | +``schema-salad-tool --codegen python https://github.com/common-workflow-language/common-workflow-language/raw/main/v1.0/CommonWorkflowLanguage.yml`` |
94 | 97 |
|
95 | | -To release CWLUtils, bump the version in `cwl_utils/__meta__.py`, and tag that |
96 | | -commit with the new version. The [gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) |
| 98 | +``cwl_utils/parser/cwl_v1_1.py`` was created via |
| 99 | +``schema-salad-tool --codegen python https://github.com/common-workflow-language/cwl-v1.1/raw/main/CommonWorkflowLanguage.yml`` |
| 100 | + |
| 101 | +``cwl_utils/parser/cwl_v1_2.py`` was created via |
| 102 | +``schema-salad-tool --codegen python https://github.com/common-workflow-language/cwl-v1.2/raw/1.2.1_proposed/CommonWorkflowLanguage.yml`` |
| 103 | + |
| 104 | +Release |
| 105 | +~~~~~~~ |
| 106 | + |
| 107 | +To release CWLUtils, bump the version in ``cwl_utils/__meta__.py``, and |
| 108 | +tag that commit with the new version. The |
| 109 | +`gh-action-pypi-publish <https://github.com/pypa/gh-action-pypi-publish>`__ |
97 | 110 | should release that tag. |
| 111 | + |
0 commit comments