Skip to main content

Fork of python-cwlgen | Generation of CWL programmatically. Avaible types: CommandLineTool, Workflow and Requirements

Project description

python-cwlgen

(From original repository)

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.


I've forked this repository to try and get my use of this repository working quickly without worrying too much about proper code etiquette. I have and will continue to submit merge requests back to the original repository.

Build Status codecov PyPI version

Common Workflow Language

Common Workflow Language (CWL) is a method to describe workflows, and any tools (software) that it may use. The user guide gives a gentle (and better) explanation of what its goals are, and how they are achieved, but broadly:

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

This python repository is simply 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 isn't going to sanity or quality check Workflows or CommandLineTools for you, use CWLTool or WOMTool for that.

Quick-start guide

This is available through PIP!

pip install illusional.cwlgen

How it works ?

There's a pretty close copy of the cwl specifications (Workflow| CommandLineTool), where the Python classes mirror the CWL spec. This repository also includes some of the docstrings to give you context of classes and their properties.

I've tried to include direct links to a classes documentation, however this isn't always possible.

There are some small examples in the examples/ folder, however for whatever class you need, you simply just init that class, for example:

Creating a CommandLineTool

# if using gitsubmodules, you can use the following import statement
import cwlgen as cwl

tool_object = cwl.CommandLineTool(cwltool_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(cwl.CommandInputParameter("myParamId", label=None, secondary_files=None, param_format=None,
                 streamable=None, doc=None, input_binding=None, default=None, param_type=None))
                 
# fill in the fields as required

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

# dump using a yaml exporter
yaml.dump(dict_to_export)

All of the classes should work in a similar way. I've removed the literal representation from my fork as I didn't want to use ruamel at the moment. Otherwise file an issue and I'll have a look into it.

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

illusional.cwlgen-0.0.5.tar.gz (25.6 kB view hashes)

Uploaded Source

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