Skip to main content

Generation of CWL programmatically. Available types: Workflow, CommandLineTool and Requirements

Project description

python-cwlgen

Build Status codecov Documentation Status PyPI version

Python-cwlgen is a python library for the generation of CWL programmatically. It supports the generation of CommandLineTool, Workflow and DockerRequirement. The library works for both Python 2.7.12+ and 3.6.0.


Common Workflow Language

Common Workflow Language (CWL) is a language to describe workflows. The user guide gives a gentle explanation of what its goals are, but broadly:

  1. Stop writing bash scripts for long complex jobs.
  2. Take pipelines anywhere (portability).
  3. Enforce reproducibility guidelines.

This python repository is a python wrapper for most of the classes (work in progress), allowing you to build the structure of the workflow in Python and have this module generate and export CWL for you.

Nb: This doesn't check the logic of Workflows or CommandLineTools for you.
CWLTool has a --validate mode that you can use.

Quick-start guide

You can install python-cwlgen through pip with the following command:

pip install cwlgen

How it works?

This repository contains a number of python classes that mirror the CWL specifications (Workflow| CommandLineTool). In essence, each class's initializer has all of the properties it expects, which may be another object. The classes include the relevant docstrings to give you context of classes and their properties.

The examples/ folder contains some simple examples, however in essence you simply initialize the class you're trying to build. An initializer for a class has all of the properties it expects which may be another object.

Creating a CommandLineTool

import cwlgen

tool_object = cwlgen.CommandLineTool(tool_id="echo-tool", base_command="echo", label=None, doc=None,
                 cwl_version="v1.0", stdin=None, stderr=None, stdout=None, path=None)
tool_object.inputs.append(
    cwlgen.CommandInputParameter("myParamId", param_type="string", label=None, secondary_files=None, param_format=None,
                 streamable=None, doc=None, input_binding=None, default=None)
)

# to get the dictionary representation:
dict_to_export = tool_object.get_dict()

# to get the string representation (YAML)
yaml_export = tool_object.export_string()

# print to console
tool_object.export()

# print to file
tool_object.export("echotool.cwl")

References

CWL is developed by an informal, multi-vendor working group consisting of organizations and individuals aiming to enable scientists to share data analysis workflows. The CWL project is on Github.

Known issues

  • SchemaDefRequirement doesn't parse the types subfield into the specific types (InputRecordSchema | InputEnumSchema | InputArraySchema), but leaves them as a simple dictionary.

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

cwlgen-kclhi-0.4.0.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

cwlgen_kclhi-0.4.0-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file cwlgen-kclhi-0.4.0.tar.gz.

File metadata

  • Download URL: cwlgen-kclhi-0.4.0.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.1

File hashes

Hashes for cwlgen-kclhi-0.4.0.tar.gz
Algorithm Hash digest
SHA256 5e48254248ac980bf5cfd42950193650836139e233504049005a919a9c66a7c7
MD5 a821e1d386f263bfa14fac6b7453a123
BLAKE2b-256 46577dc44051fff3c80e3fbdb21b53588e2e48ecef19d7f770a0fdf7859567fb

See more details on using hashes here.

File details

Details for the file cwlgen_kclhi-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: cwlgen_kclhi-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 23.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.1

File hashes

Hashes for cwlgen_kclhi-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 095bfc5d5907feb33b69602c866a40ff4adba8d4f4285a1f2b0e6f5ba115723d
MD5 7fb08e899443238cec40010be12b88ab
BLAKE2b-256 5ae6bb46d7c926b73b7cdd4a5a045ff75c91e11f39428270ece5c180e4d19f1a

See more details on using hashes here.

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