Skip to main content

FAIRWorkflows python library

Project description

Build Status Documentation Status Coverage Status PyPI version fair-software.eu Binder CII Best Practices

fairworkflows python library

fairworkflows is a high-level, user-friendly python library that supports the construction, manipulation and publishing of FAIR scientific workflows using semantic technologies.

Background

fairworkflows is developed as a component of the FAIR Workbench, as part of the FAIR is FAIR project.

The focus is on description of workflows consisting of manual and computational steps using semantic technology, such as the ontology described in the publication:

Celebi, R., Moreira, J. R., Hassan, A. A., Ayyar, S., Ridder, L., Kuhn, T., & Dumontier, M. (2019). Towards FAIR protocols and workflows: The OpenPREDICT case study. arXiv:1911.09531.

The goals of the project are:

  1. To facilitate the construction of RDF descriptions of a variety of scientific 'workflows', in the most general sense. This includes experimental procedures, ipython notebooks, computational analysis of results, etc.
  2. To allow validation and publication of the resultant RDF (for example, by means of nanopublications).
  3. Re-use of previously published steps, in new workflows.
  4. FAIR data flow from end-to-end.

We seek to provide an easy-to-use python interface for achieving the above.

Documentation

Checkout the user documentation.

Installation

The most recent release can be installed from the python package index using pip:

pip install fairworkflows

To publish workflows to the nanopub server you need to setup your nanopub profile. This allows the nanopub server to identify you. Run the following in the terminal after installation:

setup_nanopub_profile

This will add and store RSA keys to sign your nanopublications, publish a nanopublication with your name and ORCID iD to declare that you are using using these RSA keys, and store your ORCID iD to automatically add as author to the provenance of any nanopublication you will publish using this library.

Quick demo

Try out the library in this online executable notebook: Binder

Quick Start

Import from fairworkflows library

from fairworkflows import is_fairworkflow, is_fairstep, FairWorkflow

Define a step for your workflow

Mark a function as a FAIR step using the is_fairstep decorator. Use keyword arguments to semantically annotate the step. In this example to provide a label and describe that this is a script task.

@is_fairstep(label='Addition', is_script_task=True)
def add(x: float, y: float) -> float:
    """Adding up numbers."""
    return x + y

Define your workflow

Define your workflow by calling previously defined step functions. Mark the function as a workflow using the is_fairworkflow decorator.

@is_fairworkflow(label='My Workflow')
def my_workflow(in1, in2):
    """
    A simple workflow
    """
    t1 = add(in1, in2)
    return t1

Construct and publish a workflow

Construct a FairWorkflow object from the function defining the workflow and publish as nanopublication.

workflow = FairWorkflow.from_function(my_workflow)
workflow.publish_as_nanopub(use_test_server=True, publish_steps=True)

Execute the workflow

Execute the workflow and inspect the prospective provenance

result, prov = workflow.execute(1, 4)
print(prov)

Example notebook

How is the fairworkflows library expected to be used?

While this library could be used as a standalone tool to build/publish RDF workflows, it is intended more as a component to be used in a variety of other tools that seek to add FAIR elements to workflows. At present the library is used in the following tools:

  • FAIRWorkflowsExtension: A Jupyter Lab extension that adds a widget for searching for previously published FairSteps or FairWorkflows. These can then be loaded into the notebook for modification or combination into new workflows.

It is expected that the library will soon interact with FAIR Data Points as well e.g. fairdatapoint.

Relation to existing workflow formats/engines (e.g. CWL, WDL, Snakemake etc)

This library is not intended to replace or compete with the hundreds of existing computational workflow formats, but rather to aid in RDF description and comparison of workflows in the most general sense of the term (including manual experiemental steps, notebooks, and so on). Steps in a FAIRWorkflow may very well be 'run this CWL workflow' or 'run this script', so such workflows are expected to sit more on a meta-level, describing the before-and-after of running one of these fully automated computational workflows as well.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

fairworkflows-0.2.8-py3-none-any.whl (36.8 kB view details)

Uploaded Python 3

File details

Details for the file fairworkflows-0.2.8-py3-none-any.whl.

File metadata

  • Download URL: fairworkflows-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 36.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for fairworkflows-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 e618d531ad8c4fcbf7b5b9c4bfb0756d235a243c15fce5c5d31c04f8d2bda169
MD5 44a3bcd50db02b664a5bebb8c90141a4
BLAKE2b-256 e9a911e717352b9e13b4f9e6daee234d7eb496a19ba30f1f3849036e9347c906

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