d4rkstar commented on code in PR #61: URL: https://github.com/apache/openserverless-site/pull/61#discussion_r2078919127
########## content/en/docs/reference/runtimes/python/_index.md: ########## @@ -0,0 +1,138 @@ +--- +title: Python +description: +weight: 50 +--- + + +<!-- +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +--> + +## Creating and invoking Python actions + +The process of creating Python actions is similar to that of other actions. +The following sections guide you through creating and invoking a single Python action, +and demonstrate how to bundle multiple Python files and third party dependencies. + +1.Create a Python_app folder and then create a `package` directory.Now create a Python file with the following content inside our `packages/python`. For this example, the file name is `hello.py`. + + ```Python +#--web true +#--kind python:default + +def main(args): + name = args.get("name", "stranger") + result = f"Hello {name}!" + print(result) + return {"greeting": result} + + ``` + + The Python file might contain additional functions. + However, by convention, a function called `main` must exist to provide the entry point for the action. + + Your directory structure should looks like this: + + ```shell Review Comment: the file should be a .py one? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@openserverless.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org