From 0ca6c352f78ea764a5066bbb9a97ce22dfc762a1 Mon Sep 17 00:00:00 2001 From: Elad Cohen Date: Thu, 13 Jun 2024 18:20:02 +0300 Subject: [PATCH] wip --- .github/workflows/build.yml | 41 ------------------------------------- pyproject.toml | 2 +- wing.py | 14 +------------ 3 files changed, 2 insertions(+), 55 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab205c8..6c9cc7c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,44 +49,3 @@ jobs: path: dist/ - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - - github-release: - name: Upload release GitHub - needs: - - publish-to-pypi - runs-on: ubuntu-latest - - permissions: - contents: write # IMPORTANT: mandatory for making GitHub Releases - id-token: write # IMPORTANT: mandatory for sigstore - - steps: - - name: Download all the dists - uses: actions/download-artifact@v4 - with: - name: python-package-distributions - path: dist/ - - name: Sign the dists with Sigstore - uses: sigstore/gh-action-sigstore-python@v2.1.1 - with: - inputs: >- - ./dist/*.tar.gz - ./dist/*.whl - - name: Create GitHub Release - env: - GITHUB_TOKEN: ${{ github.token }} - run: >- - gh release create - '${{ github.ref_name }}' - --repo '${{ github.repository }}' - --notes "" - - name: Upload artifact signatures to GitHub Release - env: - GITHUB_TOKEN: ${{ github.token }} - # Upload to GitHub Release using the `gh` CLI. - # `dist/` contains the built packages, and the - # sigstore-produced signatures and certificates. - run: >- - gh release upload - '${{ github.ref_name }}' dist/** - --repo '${{ github.repository }}' \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index fd928b5..232ff91 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "wingsdk" -version = "0.0.3" +version = "0.0.4" description = "Wing SDK in Python" authors = [{name = "Elad Cohen", email = "eladc@wing.cloud"}] readme = "README.md" diff --git a/wing.py b/wing.py index dd4b935..de4435f 100644 --- a/wing.py +++ b/wing.py @@ -191,7 +191,6 @@ def lifted(id: str): if id in jsonValue: return create_client(jsonValue[id]) - print(f"Client with id={id} not found") raise Exception(f"Client not found (id={id}).") def create_client(idValue: dict): @@ -216,18 +215,12 @@ def create_client(idValue: dict): return SESEmailService_aws(idValue["props"]) elif target == "sim": return SESEmailService_sim(create_client(idValue["children"]["store"])) - -def _set_context(event): - context = json.loads(event["context"]) - for key, value in context.items(): - os.environ[key] = value - + def from_function_event(event): target = os.getenv(f"WING_TARGET") if target == "tf-aws": return str(event) elif target == "sim": - _set_context(event) payload = event["payload"] return payload if isinstance(payload, str) else json.dumps(payload) else: @@ -238,7 +231,6 @@ def from_topic_event(event): if target == "tf-aws": return [event["Records"][0]["Sns"]["Message"]] elif target == "sim": - _set_context(event) return [str(event["payload"])] else: raise Exception(f"Unsupported target: {target}") @@ -248,7 +240,6 @@ def from_queue_event(event): if target == "tf-aws": return [event["Records"][0]["body"]] elif target == "sim": - _set_context(event) return [str(event["payload"])] else: raise Exception(f"Unsupported target: {target}") @@ -267,7 +258,6 @@ def from_bucket_event(event): bucket_event.type = os.getenv("WING_BUCKET_EVENT") return [bucket_event] elif target == "sim": - _set_context(event) data = event["payload"] bucket_event = BucketEvent() bucket_event.key = data["key"] @@ -297,7 +287,6 @@ def from_api_event(event): } return req elif target == "sim": - _set_context(event) data = event["payload"] req: ApiRequest = { 'method': data["method"], @@ -344,7 +333,6 @@ def api_to_lambda(event: dict[str, Any]): if target == "tf-aws": return req elif target == "sim": - _set_context(event) data = event["payload"] body = data["body"] req = {