cool-easter-32542
06/04/2024, 11:26 PMpython_aws_lambda_function, python_aws_lambda_layer have some built-in complete platform JSON files, computed from the Docker images AWS publishes. These are used based on runtime="python3.X" (or the inferred runtime from interpreter constraints) automatically, e.g. if someone writes runtime="python3.10" or has interpreter_constraints = ["==3.10.*"], we'll pass --complete-platforms ... with this file https://github.com/pantsbuild/pants/blob/cc5577ed867400cb003da75aa1a9d44812ecf940/src/python/pants/backend/awslambda/python/complete_platform_3.10-x86_64.json to the PEX build, to do a more accurate cross-build.
However, someone is using an (implied) runtime that Pants doesn't have support for (e.g. runtime="python3.12" currently, before #21004 lands), then we silently fall back to computing an equivalent --platform argument. This leads to spurious errors, because --platform is an coarse summary:
pants/src/python/pants/backend/python/util_rules/faas.py
Lines 400 to 403 in </pantsbuild/pants/commit/2e5c50511f809aa3c007bb54924277c3b0348f64|2e5c505>
This is conceptually the same problem as #19978, but requires a separate solution.
We should deprecate and remove this behaviour, as it's too error prone. Steps to make this nicer to for users:
1. add more complete platforms for GCF (currently has none #18195 )
2. expand the runtime fields's documentation to reference the supported ones
3. make sure the error message is specific about what to do (either use complete_platforms or run within a docker image)
Pants version
2.21.0
OS
macOS
Additional info
Example that's likely to be caused by this: https://chat.pantsbuild.org/t/18879314/i-upgraded-the-python-interpreter-version-from-3-9-to-3-12-f#4340b966-a9dc-4202-9d16-bb30085d4cd6
pantsbuild/pants