Skip to main content

No project description provided

Reason this release was yanked:

broken format field parsing and other issues

Project description

Linux Build Status Code coverage Documentation Status

cwl-utils

Python Utilities and Autogenerated Classes for loading and parsing CWL v1.0, CWL v1.1, and CWL v1.2 documents.

Requires Python 3.8+

Installation

pip3 install cwl-utils

To install from source:

git clone https://github.com/common-workflow-language/cwl-utils.git
cd cwl-utils
pip3 install .

Usage

Pull the all referenced software container images

cwl-docker-extract is useful to cache or pre-pull all software container images referenced in a CWL CommandLineTool or CWL Workflow (including all referenced CommandLineTools and sub-Workflows and so on).

The default behaviour is to use the Docker engine to download and save the software container images in Docker format.

cwl-docker-extract path_to_my_workflow.cwl
cwl-docker-extract --dir DIRECTORY path_to_my_workflow.cwl

Or you can use the Singularity software container engine to download and save the software container images and convert them to the Singularity format at the same time.

cwl-docker-extract --singularity --dir DIRECTORY path_to_my_workflow.cwl

Replace CWL Expressions with concrete steps

cwl-expression-refactor refactors CWL documents so that any CWL Expression evaluations are separate steps (either CWL ExpressionTools or CWL CommandLineTools.) This allows execution by CWL engines that do not want to support inline expression evaluation outside of concrete steps, or do not want to directly support CWL’s optional InlineJavascriptRequirement at all.

cwl-expression-refactor directory/path/to/save/outputs path_to_my_workflow.cwl [more_workflows.cwl]

Split a packed CWL document

cwl-graph-split splits a packed CWL document file into multiple files.

Packed CWL documents use the $graph construct to contain multiple CWL Process objects (Workflow, CommandLineTool, ExpressionTool, Operation). Typically packed CWL documents contain a CWL Workflow under the name “main” and the workflow steps (including any sub-workflows).

cwl-graph-split --outdir optional/directory/path/to/save/outputs path_to_my_workflow.cwl

Normalize a CWL document

cwl-normalizer normalizes one or more CWL document so that for each document, a JSON format CWL document is produces with it and all of its dependencies packed together, upgrading to CWL v1.2, as needed. Can optionally refactor CWL Expressions into separate steps in the manner of cwl-expression-refactor.

cwl-normalizer directory/path/to/save/outputs path_to_my_workflow.cwl [more_workflows.cwl]

Using the CWL Parsers

from pathlib import Path
from ruamel import yaml
import sys

from cwl_utils.parser import load_document_by_uri, save

# File Input - This is the only thing you will need to adjust or take in as an input to your function:
cwl_file = Path("testdata/md5sum.cwl")  # or a plain string works as well

# Import CWL Object
cwl_obj = load_document_by_uri(cwl_file)

# View CWL Object
print("List of object attributes:\n{}".format("\n".join(map(str, dir(cwl_obj)))))

# Export CWL Object into a built-in typed object
saved_obj = save(cwl_obj)
print(f"Export of the loaded CWL object: {saved_obj}.")

Development

Regenerate parsers

To regenerate install the schema_salad package and run:

cwl_utils/parser/cwl_v1_0.py was created via schema-salad-tool --codegen python https://github.com/common-workflow-language/common-workflow-language/raw/codegen/v1.0/CommonWorkflowLanguage.yml --codegen-parser-info "org.w3id.cwl.v1_0" > cwl_utils/parser/cwl_v1_0.py

cwl_utils/parser/cwl_v1_1.py was created via schema-salad-tool --codegen python https://github.com/common-workflow-language/cwl-v1.1/raw/codegen/CommonWorkflowLanguage.yml --codegen-parser-info "org.w3id.cwl.v1_1" > cwl_utils/parser/cwl_v1_1.py

cwl_utils/parser/cwl_v1_2.py was created via schema-salad-tool --codegen python https://github.com/common-workflow-language/cwl-v1.2/raw/1.2.1_proposed/CommonWorkflowLanguage.yml --codegen-parser-info "org.w3id.cwl.v1_2" > cwl_utils/parser/cwl_v1_2.py

Release

To release CWLUtils, bump the version in cwl_utils/__meta__.py, and tag that commit with the new version. The gh-action-pypi-publish should release that tag.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cwl-utils-0.30.tar.gz (298.8 kB view details)

Uploaded Source

Built Distribution

cwl_utils-0.30-py3-none-any.whl (353.5 kB view details)

Uploaded Python 3

File details

Details for the file cwl-utils-0.30.tar.gz.

File metadata

  • Download URL: cwl-utils-0.30.tar.gz
  • Upload date:
  • Size: 298.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for cwl-utils-0.30.tar.gz
Algorithm Hash digest
SHA256 d9a47a434fceb886ee4e2a3346485e4e3d51dbf661db9d063335aa30eb7f5f6b
MD5 e9e61d9c35c7fbafe1b26798d30afb2f
BLAKE2b-256 6222472f441d29df8fe45a8cf65d6ecef2b9216606dc3649b80774f510004cd0

See more details on using hashes here.

Provenance

File details

Details for the file cwl_utils-0.30-py3-none-any.whl.

File metadata

  • Download URL: cwl_utils-0.30-py3-none-any.whl
  • Upload date:
  • Size: 353.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for cwl_utils-0.30-py3-none-any.whl
Algorithm Hash digest
SHA256 4234dfd8025a3384ab9fefc8f336cb689952db89732d793820732d8599fa0f17
MD5 c48eebd66b7a18cfe5f1499076d1d3dd
BLAKE2b-256 59fbe722a3e5db90d6866991d59aa04e285446101c0cbb89015d7e3b3029f19e

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page