0.1.2 • Published 1 year ago

@winglibs/python v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

python

A Wing library for running Python code in inflight.

Prerequisites

Installation

npm i @winglibs/python

Usage

bring python;

let func = new cloud.Function(new python.InflightFunctionHandler(
  path: "./test-assets",
  handler: "main.handler"
).lift("bucket", bucket, allow: ["get", "put"]));

test "invokes the function" {
  let res = func.invoke();
}

It is also possible to interact with Wing resources through the python code

// main.w
let bucket = new cloud.Bucket();
let func = new cloud.Function(new python.InflightFunctionHandler(
  path: "./test-assets",
  handler: "main.handler"
).lift("bucket", bucket, allow: ["get", "put"]));

func.liftClient("bucket", bucket, ["get", "put"]);
# main.py
from wing import *

def handler(event, context):
  client = lifted("bucket")
  client.put("test.txt", "Hello, world!")
  
  return {
    "statusCode": 200,
    "body": "Hello!"
  }

Supported Wing Resource:

  • cloud.Bucket: get, put

License

This library is licensed under the MIT License.

0.0.10

1 year ago

0.0.11

1 year ago

0.0.12

1 year ago

0.1.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago