<#19544 Call for testing/feedback: Improvements to...
# github-notifications
c
#19544 Call for testing/feedback: Improvements to AWS Lambda and Google Cloud Functions support in 2.17 and 2.18 New discussion created by huonw In Pants 2.17 and 2.18 (and 2.19), there's a bunch of improvements to Pants' support for building AWS Lambda and Google Cloud Function artifacts for Python code. I've mostly tested these locally and in my own work repo, but it'd be great for others to experiment with them: the earlier we identify issues and improvements, the better! The changes are: 1. 2.17: 1. a new static layout is available for both
python_awslambda
and
python_google_cloud_function
, with dependencies and code all at the top level, without requiring the dynamic PEX initialisation (that is, no use of Lambdex/PEX at runtime, only build time) 2. the old layout is deprecated but still the default 2. 2.18: 1. the new layout is the default 2. support for building Layers, via the new
python_aws_lambda_layer
target 3.
python_awslambda
target renamed to
python_aws_lambda_function
, for consistency with the layer target and
python_google_cloud_function
4. the
runtime=...
field can be inferred, if the interpreter constraints are unambiguous, e.g.
CPython==3.10.*
will imply
runtime="python3.10"
5. if the
runtime
field value is known to pants (including when inferred, above), a static complete platform JSON file is used, for more precise/useful dependency selection (cf. https://github.com/pantsbuild/pants/discussions/18756). NB. this is currently only for AWS Lambda (#18195 (comment)). 3. 2.19: 1. the old layout will be removed, and the new layout will be the only one supported For testing, the usual approach for pants is upgrading one major release at a time: 1. make sure you're on 2.16 2. upgrade to 2.17 (
pants_version = "2.17.0rc2"
at the time of writing), resolve the warnings and validate it 3. upgrade to 2.18 (
pants_version = "2.18.0.dev6"
), resolve the warnings and validate it. Both of these are pre-releases, so testing locally or in a dev environment is fine, but a reasonably accurate simulation of your prod environment(s) will find the most bugs 😄 The 2.17 docs are at https://www.pantsbuild.org/v2.17/docs/awslambda-python and https://www.pantsbuild.org/v2.17/docs/google-cloud-function-python. The 2.18 docs are at https://github.com/pantsbuild/pants/blob/bff43abdc632b6e196b9e97882353eee23baaf61/docs/markdown/Python/python-integrations/awslambda-python.md and https://github.com/pantsbuild/pants/blob/bff43abdc632b6e196b9e97882353eee23baaf61/docs/markdown/Python/python-integrations/google-cloud-function-python.md Let me know here any issues/hitches/questions, e.g. with errors/warnings, with runtime behaviour, with how to configure
BUILD
files, anything else! pantsbuild/pants