{"id":15043322,"url":"https://github.com/giannisdoukas/ipython2cwl-demo","last_synced_at":"2026-01-30T19:32:25.588Z","repository":{"id":93877736,"uuid":"276232917","full_name":"giannisdoukas/ipython2cwl-demo","owner":"giannisdoukas","description":"IPython2CWL Demo","archived":false,"fork":false,"pushed_at":"2020-07-09T20:04:23.000Z","size":119,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-08T05:44:45.924Z","etag":null,"topics":["common-workflow-language","cwl","jupyter-notebook"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/giannisdoukas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-06-30T23:46:57.000Z","updated_at":"2022-10-11T03:43:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"acd68c59-2a2b-4cf6-9d8b-7d8e41c8697c","html_url":"https://github.com/giannisdoukas/ipython2cwl-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/giannisdoukas/ipython2cwl-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giannisdoukas%2Fipython2cwl-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giannisdoukas%2Fipython2cwl-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giannisdoukas%2Fipython2cwl-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giannisdoukas%2Fipython2cwl-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/giannisdoukas","download_url":"https://codeload.github.com/giannisdoukas/ipython2cwl-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giannisdoukas%2Fipython2cwl-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28918220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T19:10:10.838Z","status":"ssl_error","status_checked_at":"2026-01-30T19:06:40.573Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["common-workflow-language","cwl","jupyter-notebook"],"created_at":"2024-09-24T20:48:51.512Z","updated_at":"2026-01-30T19:32:25.582Z","avatar_url":"https://github.com/giannisdoukas.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IPython2CWL DEMO\n\nThis demo requires ipython2cwl\n\n```sh\n$ pip install ipython2cwl\n```\n\n\n\nThis example is based on demo1.ipynb. \n\n* You can clone the repo or,\n* You can execute:\n  * jupyter-repo2cwl https://github.com/giannisdoukas/ipython2cwl-demo -o .\n  * That command will generate a docker image \u0026 a file named demo1.cwl in your current working directory\n  * You can still execute the Jupyter Notebook by executing: `$ docker run -p 127.0.0.1:8888:8888 THE_NAME_OF_THE_GENERATED_IMAGE`\n  * You can find the generated image id or in the logs produced by the jupyter-ipython2cwl or in the generated cwl file. \n\n---\n\nUsers can use typing hints in string format or by importing the library.\n\n```python\n!echo \"Hello World 1\" \u003e message1.txt\nfile_input1: 'CWLFilePathInput' = 'message1.txt'\nwith open(file_input1, 'r') as f:\n    data1 = f.read()    \n```\n\n\n```python\n!echo \"Hello World 2\" \u003e message2.txt\nfrom ipython2cwl.iotypes import CWLFilePathInput\nfile_input2: CWLFilePathInput = 'message2.txt'\nwith open(file_input2, 'r') as f:\n    data2 = f.read()\n```\n\nFor each variable which has the typing hints the tool will remove the presented assigment and it will generify it and expose it as a command line argument. \n\nCurrently the supported type hints are: \n* CWLFilePathInput\n* CWLBooleanInput\n* CWLStringInput\n* CWLIntInput\n* CWLFilePathOutput\n\nThese types can be also combined with List \u0026 Optional.\n\n\n```python\nimport os\nfrom typing import List\nfrom ipython2cwl.iotypes import CWLStringInput\nmessages1: List[CWLStringInput] = [\"message1:\", \"hello\", \"world\", '!']\nmessages2: List['CWLStringInput'] = [\"message2:\", \"hello\", \"world\", \"!!\"]\nmessages3: 'List[CWLStringInput]' = [\"message3:\", \"hello\", \"world\", \"!!!\"]\nmessages4: 'Optional[CWLStringInput]' = \"messages4\"\n\nprint(' '.join(messages1))\nprint(' '.join(messages2))\nprint(' '.join(messages3))\nif messages4 is None:\n    print('='*20)\n    print(\"Message 4 is None\")\n    print('='*20)\nelse:\n    print(messages4)\n```\n\n    message1: hello world !\n    message2: hello world !!\n    message3: hello world !!!\n    messages4\n\n\nTo store the results to a file we have to define a variable and give the hint CWLFilePathOutput.\n\n\n```python\noutput: 'CWLFilePathOutput' = 'output.txt'\nwith open(output, 'w') as f:\n    f.write(' '.join(messages1))\n    f.write(os.linesep)\n    f.write('-'*10)\n    f.write(os.linesep)\n    f.write(' '.join(messages2))\n    f.write(os.linesep)\n    f.write('-'*10)\n    f.write(os.linesep)\n    f.write(' '.join(messages3))\n```\n\n\n```python\n!cat output.txt\n```\n\n    message1: hello world !\n    ----------\n    message2: hello world !!\n    ----------\n    message3: hello world !!!\n\nThe auto-generated CWL file will look like:\n\n\n```python\n# !cat ../out/demo1.cwl\n```\n\n    arguments:\n    - --\n    baseCommand: /app/cwl/bin/demo1\n    class: CommandLineTool\n    cwlVersion: v1.1\n    hints:\n      DockerRequirement:\n        dockerImageId: r2d-2fvar-2ffolders-2fk8-2f800hfw-5fn2md-5f2zb44lhhtqqr0000gn-2ft-2frepo2cwl-5fixi144l4-2frepo1593555577\n    inputs:\n      file_input1:\n        inputBinding:\n          prefix: --file_input1\n        type: File\n      file_input2:\n        inputBinding:\n          prefix: --file_input2\n        type: File\n      messages1:\n        inputBinding:\n          prefix: --messages1\n        type: string[]\n      messages2:\n        inputBinding:\n          prefix: --messages2\n        type: string[]\n      messages3:\n        inputBinding:\n          prefix: --messages3\n        type: string[]\n      messages4:\n        inputBinding:\n          prefix: --messages4\n        type: string?\n    outputs:\n      output:\n        outputBinding:\n          glob: output.txt\n        type: File\n\n\nand the auto generated script looks like: \n```sh\n$ docker run -it r2d-2fvar-2ffolders-2fk8-2f800hfw-5fn2md-5f2zb44lhhtqqr0000gn-2ft-2frepo2cwl-5fixi144l4-2frepo1593555577 cat /app/cwl/bin/demo1 # this command will display the auto-generated script to the terminal\n```\n\n```python\n#!/usr/bin/env ipython\n\"\"\"\nDO NOT EDIT THIS FILE\nTHIS FILE IS AUTO-GENERATED BY THE ipython2cwl.\nFOR MORE INFORMATION CHECK https://github.com/giannisdoukas/ipython2cwl\n\"\"\"\n\n\ndef main(file_input1, file_input2, messages1, messages2, messages3, messages4):\n    get_ipython().system('echo \"Hello World 1\" \u003e message1.txt')\n    with open(file_input1, 'r') as f:\n        data1 = f.read()\n    get_ipython().system('echo \"Hello World 2\" \u003e message2.txt')\n    with open(file_input2, 'r') as f:\n        data2 = f.read()\n    import os\n    from typing import List\n    print(' '.join(messages1))\n    print(' '.join(messages2))\n    print(' '.join(messages3))\n    if messages4 is None:\n        print('=' * 20)\n        print('Message 4 is None')\n        print('=' * 20)\n    else:\n        print(messages4)\n    output = 'output.txt'\n    with open(output, 'w') as f:\n        f.write(' '.join(messages1))\n        f.write(os.linesep)\n        f.write('-' * 10)\n        f.write(os.linesep)\n        f.write(' '.join(messages2))\n        f.write(os.linesep)\n        f.write('-' * 10)\n        f.write(os.linesep)\n        f.write(' '.join(messages3))\n    get_ipython().system('cat output.txt')\n\n\nif __name__ == '__main__':\n    import argparse\n    import pathlib\n    parser = argparse.ArgumentParser()\n    parser.add_argument('--file_input1', type=pathlib.Path, required=True)\n    parser.add_argument('--file_input2', type=pathlib.Path, required=True)\n    parser.add_argument('--messages1', type=str, required=True, nargs='+')\n    parser.add_argument('--messages2', type=str, required=True, nargs='+')\n    parser.add_argument('--messages3', type=str, required=True, nargs='+')\n    parser.add_argument('--messages4', type=str, required=False, default=None)\n    args = parser.parse_args()\n    main(file_input1=args.file_input1, file_input2=args.file_input2,\n        messages1=args.messages1, messages2=args.messages2, messages3=args.\n        messages3, messages4=args.messages4)\n```\n\nYou can use try execute the generated workflow with the files in.yaml \u0026 in2.yaml\n```sh\n$ cwltool demo1.cwl in.yaml\n\n$ cwltool demo1.cwl in1.yaml\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiannisdoukas%2Fipython2cwl-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgiannisdoukas%2Fipython2cwl-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiannisdoukas%2Fipython2cwl-demo/lists"}