IPython2CWL: Convert Jupyter Notebook to CWL

https://travis-ci.com/giannisdoukas/ipython2cwl.svg?branch=master https://coveralls.io/repos/github/giannisdoukas/ipython2cwl/badge.svg?branch=master https://pepy.tech/badge/ipython2cwl/month

IPython2CWL is a tool for converting IPython Jupyter Notebooks to CWL Command Line Tools by simply providing typing annotation.

from ipython2cwl.iotypes import CWLFilePathInput, CWLFilePathOutput
import csv
input_filename: 'CWLFilePathInput' = 'data.csv'
with open(input_filename) as f:
  csv_reader = csv.reader(f)
  data = [line for line in csv_reader]
number_of_lines = len(data)
result_file: 'CWLFilePathOutput' = 'number_of_lines.txt'
with open(result_file, 'w') as f:
  f.write(str(number_of_lines))

IPython2CWL is based on repo2docker, the same tool used by mybinder. Now, by writing Jupyter Notebook and publish them, including repo2docker configuration, the community can not only execute the notebooks remotely but also to use them as steps in scientific workflows.

  • Install ipython2cwl: pip install python2cwl
  • Ensure that you have docker running
  • Create a directory to store the generated cwl files, for example cwlbuild
  • Execute jupyter repo2cwl https://github.com/giannisdoukas/cwl-annotated-jupyter-notebook.git -o cwlbuild

Indices and tables