{"id":14988417,"url":"https://github.com/apache/openwhisk-composer-python","last_synced_at":"2025-07-29T04:08:06.147Z","repository":{"id":53783982,"uuid":"159727738","full_name":"apache/openwhisk-composer-python","owner":"apache","description":"Apache OpenWhisk Composer Python provides a high-level programming model in Python for composing serverless functions","archived":false,"fork":false,"pushed_at":"2024-09-24T14:47:37.000Z","size":166,"stargazers_count":10,"open_issues_count":3,"forks_count":15,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-07-22T15:54:37.209Z","etag":null,"topics":["apache","cloud","composer","composition","faas","functions","functions-as-a-service","openwhisk","python","serverless","serverless-architectures","serverless-functions"],"latest_commit_sha":null,"homepage":"https://openwhisk.apache.org/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apache.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","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}},"created_at":"2018-11-29T21:10:10.000Z","updated_at":"2025-01-11T07:32:34.000Z","dependencies_parsed_at":"2023-10-14T19:31:17.683Z","dependency_job_id":null,"html_url":"https://github.com/apache/openwhisk-composer-python","commit_stats":{"total_commits":85,"total_committers":9,"mean_commits":9.444444444444445,"dds":0.2705882352941177,"last_synced_commit":"948d299fd11e9d774ea8121b36acafa77e8dcd71"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/apache/openwhisk-composer-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fopenwhisk-composer-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fopenwhisk-composer-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fopenwhisk-composer-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fopenwhisk-composer-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apache","download_url":"https://codeload.github.com/apache/openwhisk-composer-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fopenwhisk-composer-python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267626911,"owners_count":24117707,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["apache","cloud","composer","composition","faas","functions","functions-as-a-service","openwhisk","python","serverless","serverless-architectures","serverless-functions"],"created_at":"2024-09-24T14:16:40.697Z","updated_at":"2025-07-29T04:08:06.110Z","avatar_url":"https://github.com/apache.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\n#\n# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements.  See the NOTICE file distributed with\n# this work for additional information regarding copyright ownership.\n# The ASF licenses this file to You under the Apache License, Version 2.0\n# (the \"License\"); you may not use this file except in compliance with\n# the License.  You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n--\u003e\n# composer-python\n\n[![Build Status](https://travis-ci.com/apache/openwhisk-composer-python.svg?branch=master)](https://travis-ci.com/apache/openwhisk-composer-python)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Join\nSlack](https://img.shields.io/badge/join-slack-9B69A0.svg)](http://slack.openwhisk.org/)\n\nThis repository provides a Python library for [Composer](https://github.com/apache/openwhisk-composer). For convenience, the Composer documentation is repeated below using Python bindings instead of JavaScript.\n\nComposer is a new programming model for composing cloud functions built on\n[Apache OpenWhisk](https://github.com/apache/openwhisk). With\nComposer, developers can build even more serverless applications including using\nit for IoT, with workflow orchestration, conversation services, and devops\nautomation, to name a few examples.\n\nThis repository includes:\n* the [composer](src/composer/composer.py) Python library for authoring compositions using Python,\n* the [pycompose](src/pycompose/__main__.py) and [pydeploy](src/pydeploy/__main__.py)\n  [commands](docs/COMMANDS.md) for compiling and deploying compositions,\n* [documentation](docs), [examples](samples), and [tests](tests).\n\n## Installation\n\nYou need python3.6 installed on your system.\n\n### From github\n\n```bash\n$ git clone https://github.com/apache/openwhisk-composer-python.git\n$ cd composer-python\n$ pip3 install -e .\n$ pycompose -h\nusage: pycompose composition.py command [flags]\n$ pydeploy -h\nusage: pydeploy composition composition.json [flags]\n```\n\n### From PyPi (**Not available yet**)\n\nComposer will eventually be distributed on [PyPi](https://pypi.org/). Once it is available, to install this package, use `pip`:\n```\n$ pip3 install openwhisk-composer\n```\nShell embeds the Composer package, so there is no need to install\nComposer for Python explicitly when using Shell.\n\n## Defining a composition\n\nA composition is typically defined by means of a Python expression as\nillustrated in [samples/demo.py](samples/demo.py):\n\n```python\nimport composer\n\ndef main():\n    return composer.when(\n        composer.action('authenticate',  { 'action': lambda args: { 'value': args['password'] == 'abc123' } }),\n        composer.action('success', { 'action': lambda args: { 'message': 'success' } }),\n        composer.action('failure', { 'action': lambda args: { 'message': 'failure' } }))\n```\nCompositions compose actions using [combinator](docs/COMBINATORS.md) methods. These methods\nimplement the typical control-flow constructs of a sequential imperative\nprogramming language. This example composition composes three actions named\n`authenticate`, `success`, and `failure` using the `composer.when` combinator,\nwhich implements the usual conditional construct. It takes three actions (or\ncompositions) as parameters. It invokes the first one and, depending on the\nresult of this invocation, invokes either the second or third action.\n\n## Deploying a composition\n\nOne way to deploy a composition is to use the `pycompose` and `pydeploy` commands:\n```\npycompose demo.py \u003e demo.json\npydeploy demo demo.json -w\n```\n```\nok: created /_/authenticate,/_/success,/_/failure,/_/demo\n```\nThe `pycompose` command compiles the composition code to a portable JSON format.\nThe `pydeploy` command deploys the JSON-encoded composition creating an action\nwith the given name. It also deploys the composed actions if definitions are\nprovided for them. The `-w` option authorizes the `deploy` command to overwrite\nexisting definitions.\n\n## Running a composition\n\nThe `demo` composition may be invoked like any action, for instance using the\nOpenWhisk CLI:\n```\nwsk action invoke demo -p password passw0rd\n```\n```\nok: invoked /_/demo with id 09ca3c7f8b68489c8a3c7f8b68b89cdc\n```\nThe result of this invocation is the result of the last action in the\ncomposition, in this case the `failure` action since the password in incorrect:\n```\nwsk activation result 09ca3c7f8b68489c8a3c7f8b68b89cdc\n```\n```json\n{\n    \"message\": \"failure\"\n}\n```\n## Execution traces\n\nThis invocation creates a trace, i.e., a series of activation records:\n```\nwsk activation list\n```\n\u003cpre\u003e\nDatetime            Activation ID                    Kind     Start Duration   Status  Entity\n2019-03-15 16:43:22 e6bea73bf75f4eb7bea73bf75fdeb703 nodejs:6 warm  1ms        success guest/demo:0.0.1\n2019-03-15 16:43:21 7efb6b7354c3472cbb6b7354c3272c98 nodejs:6 cold  31ms       success guest/failure:0.0.1\n2019-03-15 16:43:21 377cd080f0674e9cbcd080f0679e9c1d nodejs:6 warm  2ms        success guest/demo:0.0.1\n2019-03-15 16:43:20 5dceeccbdc7a4caf8eeccbdc7a9caf18 nodejs:6 cold  29ms       success guest/authenticate:0.0.1\n2019-03-15 16:43:19 66355a1f012d4ea2b55a1f012dcea264 nodejs:6 cold  104ms      success guest/demo:0.0.1\n2019-03-15 16:43:19 09ca3c7f8b68489c8a3c7f8b68b89cdc sequence warm  3.144s     success guest/demo:0.0.1\n\u003c/pre\u003e\n\nThe entry with the earliest start time (`09ca3c7f8b68489c8a3c7f8b68b89cdc`)\nsummarizes the invocation of the composition while other entries record later\nactivations caused by the composition invocation. There is one entry for each\ninvocation of a composed action (`5dceeccbdc7a4caf8eeccbdc7a9caf18` and\n`7efb6b7354c3472cbb6b7354c3272c98`). The remaining entries record the beginning\nand end of the composition as well as the transitions between the composed\nactions.\n\nCompositions are implemented by means of OpenWhisk conductor actions. The\n[documentation of conductor\nactions](https://github.com/apache/openwhisk/blob/master/docs/conductors.md)\nexplains execution traces in greater details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fopenwhisk-composer-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapache%2Fopenwhisk-composer-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fopenwhisk-composer-python/lists"}