miniwdl

1.13.1 · active · verified Thu Apr 16

miniwdl is a Python library and command-line tool for running and developing Workflow Description Language (WDL) workflows locally. It provides a WDL runtime, a parser, and utilities for WDL authors. The current version is 1.13.1, and it maintains an active release cadence, addressing bugs, updating dependencies, and enhancing WDL specification compliance.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to programmatically run a simple WDL workflow using `miniwdl.runner.run`. It creates a temporary WDL file, defines inputs, executes the workflow, and prints the output.

import miniwdl.runner
import os

# Create a simple WDL file for demonstration
wdl_content = """
version 1.0
workflow hello {
  input { String name }
  call hello_task { input: name = name }
}
task hello_task {
  input { String name }
  command { echo "Hello, ${name}!" }
  output { String message = read_string(stdout()) }
}
"""
with open("hello.wdl", "w") as f:
    f.write(wdl_content)

# Define inputs as a dictionary
inputs = {"hello.name": "WDL User"}

# Run the WDL workflow
try:
    run_result = miniwdl.runner.run(
        wdl="hello.wdl",
        inputs=inputs,
        dir=os.getcwd() # Specify directory where WDL is found
    )
    # Access outputs
    print(f"Workflow output: {run_result.outputs['hello.hello_task.message']}")
except Exception as e:
    print(f"An error occurred: {e}")
finally:
    # Clean up the dummy WDL file
    if os.path.exists("hello.wdl"):
        os.remove("hello.wdl")

view raw JSON →