cold-jackal-89755
08/21/2023, 8:42 PMcomplete_platforms instead of runtime for python_awslambda zips. I don't know the original reason my team switched but I did find this discussion: https://github.com/pantsbuild/pants/discussions/18756 Would it be helpful to have the various json files with the output for different lambda runtimes stored somewhere? I have been using the aws docker images to generate them and I think this process could be automated. Or are there too many variables in those files? Do they differ across aws regions, etc.broad-processor-92400
08/21/2023, 8:47 PMbroad-processor-92400
08/21/2023, 8:49 PMpython_aws_lambda_function(
name="my-func",
handler="./my-file.py:the_handler"
)enough-analyst-54434
08/21/2023, 8:51 PMplatform_version in PEP-508 (https://peps.python.org/pep-0508/#environment-markers) these files could be pre-generated for ~all Pythons on Linux and Mac and hosted centrally. I'm not sure if platform_version is used in the wild, but experience says yes - all these features are used or abused at least once.cold-jackal-89755
08/21/2023, 8:56 PMenough-analyst-54434
08/21/2023, 8:58 PMcold-jackal-89755
08/21/2023, 9:04 PMimport json
import subprocess
def lambda_handler(event, context):
output_file_path = "/tmp/subdir/output.txt"
with open(output_file_path, "w") as output:
subprocess.run(
"""
pip install --target=/tmp/subdir pex
PYTHONPATH=/tmp/subdir /tmp/subdir/bin/pex3 interpreter inspect --markers --tags
""",
shell=True,
stdout=output,
)
with open(output_file_path, "r") as output_file:
output_lines = output_file.readlines()
last_line = output_lines[-1].strip()
try:
body = json.loads(last_line)
except Exception:
pass
return {'statusCode': 200, 'body': body if body else {""}}cold-jackal-89755
08/21/2023, 9:05 PMcold-jackal-89755
08/21/2023, 9:06 PMenough-analyst-54434
08/21/2023, 9:10 PMenough-analyst-54434
08/21/2023, 9:10 PMcold-jackal-89755
08/21/2023, 9:16 PMenough-analyst-54434
08/21/2023, 9:28 PMcold-jackal-89755
08/21/2023, 9:30 PMcold-jackal-89755
08/21/2023, 9:32 PM