Package: alppb
Amazon Linux Python Package Builder (alppb)alppb builds Python packages using the same version of Amazon Linux that the AWS Lambda service uses. Using alppb helps guarantee that any PyPi package your AWS Lambda app depends on will run properly.Why is this a problem that needs to be solved? AWS Lambda requires you to package up your Python project along with all of its dependencies in order to run. If your AWS Lambda Python project has package(s) with C extension modules (or dependencies that do), you will need to build them on Amazon Linux for your app to work. alppb uses the AWS CodeBuild service (perpetual free tier includes 100 build minutes per month) to build the package(s) on Amazon Linux and download them to your local machine for you. Simply unzip the downloaded package(s) into your deployment bundle and upload to the AWS Lambda service.How To Use alppbpipinstallalppb
alppb-hBuild package requests in bucket fooalppb requests fooTODOPre 1.0.0Foundation - create a CodeBuild project with hardcoded build that puts an artifact in s3Fix artifact so its a zip of the contents (excluding parent dir)Download the module locally to dir alppb was run fromMove codebuild stuff to a moduleDelete the artifact from s3 as part of cleanupAdd creation of IAM role for CodeBuild instead of using hardcoded, pre-built roleAdd deletion of IAM role as part of cleanupMove aws-cli stuff to boto3Allow user specification of the desired module to be built using alppbCleanup existing docstringsRemove base64 stuff in iam.py as it obscures whats happeningAxe the examples dirAllow user specification of the bucket1.0.0Exception handlingUpdate and overwrite if resources already existpre-req checkingValid PyPi packageBucket and CodeBuild need to be in same regionBucket exists (NoSuchBucket)Bucket has valid name (botocore.exceptions.ParamValidationError)Unit testsIntegration testsTest each version of Python supportedVerify they're using the actual right python versions as part of each testInspect the zip and make sure it contains what's expectedPackage and Submit to PyPiMake CodeBuild Docker image details more clear and documentAdd verbosity levelsAdd Sphinx docsreadthedocs.orgPlannedOne or more modules can be specified in one invocation of alppbAllow specification of a requirements.txt file to use as a list of all modules to buildSpecify download location of the artifactCreate an s3 bucket when an arg is specifiedAllow user to optionally specify an IAM roleSpecify the Python version that should be used to build the package (choices come from supported AWS Lambda versions)Dockerize and submit to DockerhubFAQsWhy AWS CodeBuild? Why not X instead?AWS CodeBuild has a perpetual free tier and it's super easy to spin up, and teardown, a build job. Further, we can easily specify various Docker images to use for the build that match the AWS Lambda environment. I will likely add support for other build methods/services. If you have a suggestion, please open an issue or contact me on Twitter@irlrobot.What image is being used for CodeBuild? Can I inspect the image being used for the build?There are three images, one for each version of Python supported by AWS Lambda:Python 2.7 -https://hub.docker.com/r/irlrobot/alppb-python27/Dockerfile:https://github.com/irlrobot/dockerfiles/tree/master/alppb-python27Python 3.6 -https://hub.docker.com/r/irlrobot/alppb-python36/Dockerfile:https://github.com/irlrobot/dockerfiles/tree/master/alppb-python36Python 3.7 -https://hub.docker.com/r/irlrobot/alppb-python37/Dockerfile:https://github.com/irlrobot/dockerfiles/tree/master/alppb-python37Each image is running Amazon Linux 1 version 2017.03.1.20170812 which iswhat AWS Lambda uses.