Skip to content

Commit 7baa894

Browse files
author
AntoniaSzecsi
committed
Start working on RIE integration
1 parent edc5c1d commit 7baa894

File tree

3 files changed

+26
-49
lines changed

3 files changed

+26
-49
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ else
2727
python scripts/dev.py build
2828
endif
2929

30+
.PHONY: local-test
31+
local-test:
32+
python scripts/dev.py local-test
3033

3134
.PHONY: setup-codebuild-agent
3235
setup-codebuild-agent:
@@ -78,5 +81,6 @@ TARGETS
7881
lint Run all linters via scripts/dev.py.
7982
test-smoke Run smoke tests inside Docker.
8083
test-integ Run all integration tests.
84+
local-test Run the Lambda handler locally using AWS RIE.
8185

8286
endef

scripts/dev.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def clean():
4242
shutil.rmtree(path)
4343
elif path.is_file():
4444
path.unlink()
45-
45+
4646
for folder in ["dist", "build", "awslambdaric.egg-info"]:
4747
dir_path = ROOT / folder
4848
if dir_path.exists():
@@ -55,9 +55,22 @@ def build():
5555
env["BUILD"] = "true"
5656
run([sys.executable, "setup.py", "sdist", "bdist_wheel"], env=env)
5757

58+
def local_test():
59+
print("Running local tests")
60+
# will be implemented later using RIE
61+
5862
if __name__ == "__main__":
5963
parser = argparse.ArgumentParser(description="Development command-line tool")
60-
parser.add_argument("command", choices=["init", "test", "lint", "clean", "build"])
64+
parser.add_argument("command", choices=["init", "test", "lint", "clean", "build", "local-test"])
6165
args = parser.parse_args()
66+
commands = {
67+
"init": init,
68+
"test": test,
69+
"lint": lint,
70+
"clean": clean,
71+
"build": build,
72+
"local-test": local_test,
73+
}
74+
75+
commands[args.command]()
6276

63-
globals()[args.command]()

setup.py

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,30 @@
1-
"""
2-
Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3-
"""
4-
51
import os
62
import platform
73
from subprocess import check_call, check_output
8-
from setuptools import Extension, find_packages, setup
4+
from setuptools import Extension, setup
95

106
def get_curl_extra_linker_flags():
117
if platform.system() != "Linux" or os.getenv("BUILD") != "true":
128
return []
139
check_call(["./scripts/preinstall.sh"])
1410
cmd = ["./deps/artifacts/bin/curl-config", "--static-libs"]
15-
curl_config = check_output(cmd).decode("utf-8").replace("\n", "")
16-
flags = curl_config.split(" ")[1:]
17-
return flags
11+
curl_config = check_output(cmd).decode("utf-8").strip()
12+
return curl_config.split(" ")[1:]
1813

1914
def get_runtime_client_extension():
2015
if platform.system() != "Linux" and os.getenv("BUILD") != "true":
21-
print("The native runtime_client only builds on Linux. Skipping its compilation.")
16+
print("Native extension build skipped on non-Linux.")
2217
return []
23-
runtime_client = Extension(
18+
return [Extension(
2419
"runtime_client",
2520
["awslambdaric/runtime_client.cpp"],
2621
extra_compile_args=["--std=c++11"],
2722
library_dirs=["deps/artifacts/lib", "deps/artifacts/lib64"],
2823
libraries=["aws-lambda-runtime", "curl"],
2924
extra_link_args=get_curl_extra_linker_flags(),
3025
include_dirs=["deps/artifacts/include"],
31-
)
32-
return [runtime_client]
33-
34-
def readme():
35-
try:
36-
with open("README.md", encoding="utf-8") as f:
37-
return f.read()
38-
except Exception:
39-
return ""
26+
)]
4027

4128
setup(
42-
name="awslambdaric",
43-
version="3.0.2",
44-
description="AWS Lambda Runtime Interface Client for Python",
45-
long_description=readme(),
46-
long_description_content_type="text/markdown",
47-
author="Amazon Web Services",
48-
url="https://github.com/aws/aws-lambda-python-runtime-interface-client",
49-
packages=find_packages(exclude=("tests", "tests.*", "docs", "examples", "versions")),
50-
python_requires=">=3.9",
51-
install_requires=[
52-
"simplejson>=3.20.1",
53-
"snapshot-restore-py>=1.0.0",
54-
],
55-
classifiers=[
56-
"Development Status :: 5 - Production/Stable",
57-
"Intended Audience :: Developers",
58-
"Natural Language :: English",
59-
"Programming Language :: Python :: 3",
60-
"Programming Language :: Python :: 3.9",
61-
"Programming Language :: Python :: 3.10",
62-
"Programming Language :: Python :: 3.11",
63-
"Programming Language :: Python :: 3.12",
64-
"Programming Language :: Python :: 3.13",
65-
"License :: OSI Approved :: Apache Software License",
66-
"Operating System :: OS Independent",
67-
],
6829
ext_modules=get_runtime_client_extension(),
69-
test_suite="tests",
7030
)

0 commit comments

Comments
 (0)