aws / aws-lambda-builders

Python library to compile, build & package AWS Lambda functions for several runtimes & framework
Apache License 2.0
334 stars 139 forks source link

fix: Validate if pip is installed in the runtime path #549

Closed lucashuy closed 11 months ago

lucashuy commented 11 months ago

Issue #, if available: N/A.

Description of changes: Previously, the Python runtime validator would only validate if the runtime contained the correct Python for the workflow. It did not validate whether or not this runtime had pip installed inside of it or not.

This lead to a case where in a list of Python runtimes, it would select the first one that had Python without checking for pip. The correct runtime in this case would be the one that contains both Python and pip.

This change updates the build action to find and validate all the possible Python execution paths to find one that contains the correct version of Python while also containing pip.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

lucashuy commented 11 months ago

build a python lambda which doesn't have requirements.txt file

Thats a good call out. I'll move that validation logic out of the general pip validator and into the build action, that way this validation+setting of runtime will only apply to projects that the workflow has identified to build.