Skip to main content

cwl-inputs-parser

pytest flake8 isort mypy Apache License

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.

Metadata

Release files for cwl-inputs-parser 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cwl-inputs-parser 1.0.2
File Size Uploaded
cwl-inputs-parser-1.0.2.tar.gz 15.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cwl-inputs-parser 1.0.2
File Interpreter ABI Platform
cwl_inputs_parser-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 36.2 kB

Release files / cwl-inputs-parser-1.0.2.tar.gz

Download URL cwl-inputs-parser-1.0.2.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
550b43b5fad2e3bcd562f1a023602799fb2f1c28677867986c60273ad8653700
BLAKE2b-256 checksum
How to use checksums
25f926b98d85d0c34604649e5990f7df559fc3bb0e120ab04e537fc8c5abc233
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.13

Release files / cwl_inputs_parser-1.0.2-py3-none-any.whl

Download URL cwl_inputs_parser-1.0.2-py3-none-any.whl
Size 21.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6b8264b00d1001a058faa6cf0202f5605ea01ed810aa2212033c769c1f0f6b7
BLAKE2b-256 checksum
How to use checksums
d409ed7fdce3dfb818beaaa784945210f8cab02855da589ce6ad96dc11ab0eeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.13

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page