The parser of inputs field in Common Workflow Language (CWL)
Project description
cwl-inputs-parser
A library for parsing the inputs field of Common Workflow Language (CWL) document. This library aims to use it as a CWL parser to generate a web form to execute the Workflow Execution Service (WES).
As a simple example, if you input tests/all_input.cwl, tests/all_input.json will be output.
The schema of the parsed results is cwl-inputs-parser-schema.json.
We are testing using the CWL v1.2 conformance test. The list of test IDs that will not pass is tests/cwl_conformance_test/failed_test_ids.txt.
Installation
Requires Python 3.6+
To install from PyPI:
$ pip install cwl-inputs-parser
$ cwl-inputs-parser --help
To install from source:
$ git clone https://github.com/suecharo/cwl-inputs-parser.git
$ cd cwl-inputs-parser
$ pip install .
$ cwl-inputs-parser --help
To install with docker:
$ docker run -t --rm ghcr.io/suecharo/cwl-inputs-parser:latest cwl-inputs-parser --help
Usage
It is deployed at https://cwl-inputs-parser.azurewebsites.net
The easiest way to use:
$ curl -X POST https://cwl-inputs-parser.azurewebsites.net \
-d '{"wf_location": "https://raw.githubusercontent.com/suecharo/cwl-inputs-parser/main/tests/cwl_conformance_test/v1.2/wc-tool.cwl"}'
[{"array":false,"default":null,"doc":null,"id":"file1","label":null,"required":true,"secondaryFiles":null,"type":"File"}]
As command line tool
Use as a command line tool:
$ cwl-inputs-parser /path/to/cwl_document (local file path | remote URL)
As REST API server
Start the server:
$ cwl-inputs-parser --server --host 0.0.0.0 --port 8080
* Serving Flask app 'cwl_inputs_parser.server' (lazy loading)
* Environment: production
* Debug mode: off
* Running on http://172.26.0.2:8080/ (Press CTRL+C to quit)
Request with curl
:
$ curl -X get localhost:8080/health
{"status":"ok"}
# {"wf_location": "https://path/to/workflow"}
$ curl -X POST localhost:8080 -d @tests/curl_data_location.json
...
# {"wf_content": "serialized CWL contents..."}
$ curl -X POST localhost:8080 -d @tests/curl_data_content.json
...
$ curl -X POST \
localhost:8080 \
-d '{"wf_location": "https://raw.githubusercontent.com/suecharo/cwl-inputs-parser/main/tests/cwl_conformance_test/v1.2/wc-tool.cwl"}'
[{"array":false,"default":null,"doc":null,"id":"file1","label":null,"required":true,"secondaryFiles":null,"type":"File"}]
Do cwltool's --make-template
:
$ curl -X POST localhost:8080/make-template -d @tests/curl_data_location.json
"file1: # type \"File\"\n class: File\n path: a/file/path\n"
$ curl -X POST localhost:8080/make-template -d @tests/curl_data_content.json
"file1: # type \"File\"\n class: File\n path: a/file/path\n"
As python library
Use as a python library:
$ python3
Python 3.8.12 (default, Oct 13 2021, 13:56:21)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cwl_inputs_parser.utils import wf_location_to_inputs
>>> inputs = wf_location_to_inputs("./tests/cwl_conformance_test/v1.2/wc-tool.cwl")
>>> inputs.as_dict()
[{'default': None, 'doc': None, 'id': 'file1', 'label': None, 'type': 'File', 'array': False, 'required': True, 'secondaryFiles': None}]
Development
development environment:
docker-compose -f docker-compose.dev.yml up -d --build
docker-compose -f docker-compose.dev.yml exec app bash
testing:
pytest .
License
Apache-2.0. See the LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cwl-inputs-parser-1.0.2.tar.gz
.
File metadata
- Download URL: cwl-inputs-parser-1.0.2.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 550b43b5fad2e3bcd562f1a023602799fb2f1c28677867986c60273ad8653700 |
|
MD5 | 240f61a1cba35120858a3a9e967541e9 |
|
BLAKE2b-256 | 25f926b98d85d0c34604649e5990f7df559fc3bb0e120ab04e537fc8c5abc233 |
File details
Details for the file cwl_inputs_parser-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: cwl_inputs_parser-1.0.2-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6b8264b00d1001a058faa6cf0202f5605ea01ed810aa2212033c769c1f0f6b7 |
|
MD5 | c8c569afd8422f1b26082cea870f5cae |
|
BLAKE2b-256 | d409ed7fdce3dfb818beaaa784945210f8cab02855da589ce6ad96dc11ab0eeb |