Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
eladcon committed Jun 13, 2024
1 parent 1be0184 commit 0ca6c35
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 55 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}'
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
14 changes: 1 addition & 13 deletions wing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand All @@ -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}")
Expand All @@ -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}")
Expand All @@ -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"]
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 0ca6c35

Please sign in to comment.