Skip to main content

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.

Release files for illusional.cwlgen 0.0.5

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

Source distribution (sdist)

Source distribution for illusional.cwlgen 0.0.5
File Size Uploaded
illusional.cwlgen-0.0.5.tar.gz 25.6 kB Details

Release files / illusional.cwlgen-0.0.5.tar.gz

Download URL illusional.cwlgen-0.0.5.tar.gz
Size 25.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1f7fcb5c500a12b4bbd8f75aa4815da42fa6d38fedf1d2f8e05c018cc8947ab1
BLAKE2b-256 checksum
How to use checksums
c8a3ec61d96308b7453f4c76d25a645949842564ca3428c9b6b1207d37599b66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.1 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/2.7.14

Release history Release notifications | RSS feed

This release

0.0.5 This release

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

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