Skip to content

CIRSS/yw-vsce

Repository files navigation

YesWorkflow (VS Code Extension)

YesWorkflow is a user-oriented, language-independent tool for recovering workflow information from scripts. The model is described in the following two publications; this repository contains the TypeScript implementation of the YesWorkflow extension for Visual Studio Code.

Overview

YesWorkflow aims to provide a number of the benefits of using a scientific workflow management system without having to rewrite scripts and other scientific software. Rather than reimplement code so that it can be executed and managed by a workflow engine, a YesWorkflow user simply adds special YesWorkflow (YW) comments to existing scripts. These comments declare how data is used and results produced, step by step, by the script. The YesWorkflow tools interpret the YW comments and produce graphical output that reveals the stages of computation and the flow of data in the script.

Features

  • Language support: Bash (.sh), C (.c, .h), C++ (.cpp), Java (.java), MATLAB (.m), Python (.py), R (.R), and SAS (.sas)
  • Subworkflow support: Select and visualize nested workflows
  • Interactive graph visualization: Display workflows as interactive graphs in a side-by-side webview panel
  • Graph-to-code navigation: Click a graph node to highlight the corresponding lines in the script
  • View controls: Toggle visibility of steps, data, parameters, ports, boxes, and titles
  • Layout control: Switch graph layout direction between Down (top-to-bottom) and Across (left-to-right)
  • Zoom controls: Zoom in, zoom out, and fit the graph to view
  • Live reload: Automatically update the graph when the script is saved
  • Multiple export formats: Export as HTML or SVG, or copy the DOT string (via right-click in the webview panel)

Quick Start

  1. Open a supported source file.
  2. Add YesWorkflow annotations in comments.
  3. Click the "YesWorkflow: Show Workflow Graph" button (workflow icon) in the editor title toolbar (top-right corner)
  4. The workflow graph appears in a webview panel beside your script.
  5. The graph automatically updates when you save changes.

Example

The greetings example (Python):

# @begin EmphasizedHelloWorld @desc Display one or more greetings to the user.
# @in provided_greeting
# @in provided_emphasis
# @param emphasis_count
# @out displayed_greeting @desc Greeting displayed to user.

def greet_user(greeting, emphasis='!', count=1):

    """
    # @begin emphasize_greeting @desc Add emphasis to the provided greeting
    # @in greeting @as provided_greeting
    # @in emphasis @as provided_emphasis @param count @as emphasis_count
    # @out greeting @as emphasized_greeting
    """
    if (count > 0):
        for i in range(0, count):
            greeting = greeting + emphasis
    # @end emphasize_greeting

    # @begin print_greeting @desc Greet the user with the emphasized message.
    # @in greeting @as emphasized_greeting
    # @out greeting @as displayed_greeting @file stream:stdout
    print(greeting)
    # @end print_greeting

# @end EmphasizedHelloWorld

if __name__ == '__main__':
    first_greeting = 'Hello World'
    greet_user(first_greeting)
    second_greeting = 'Goodbye World'
    greet_user(second_greeting, '?', 2)
    third_emph_count = 3
    greet_user("Back again", '?!', third_emph_count)

The workflow visualization:

1. Process view

2. Data view

3. Combined view

Development

  • npm install
  • npm run compile
  • npm test
  • npx vsce package

Release Notes

v0.1.0

Initial release with interactive graph generation for script with YesWorkflow annotations.

About

A VS Code extension for YesWorkflow

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages