Various popular libraries, pre-compiled to be compatible with AWS Lambda.
Currently includes support for:
- bcrypt
- cffi
- cryptography
- LXML
- misaka
- MySQL-Python
- numpy
- OpenCV
- Pillow (PIL)
- psycopg2
- PyCrypto
- PyNaCl
- pyproj
This project is intended for use by Zappa, but could also be used by any Python/Lambda project.
pip install lambda-packages
The best way to use these packages is with Zappa, which will automatically install the right packages during deployment, and do a million other useful things. Whatever you're currently trying to do on Lambda, it'll be way easier for you if you just use Zappa right now. Trust me. It's awesome. As a bonus, Zappa now also provides support for manylinux wheels, which adds support for hundreds of other packages.
But, if you want to use this project the other (wrong) way, just put the contents of the .tar.gz archive into your lambda .zip.
lambda-packages also includes a manifest with information about the included packages and the paths to their binaries.
from lambda_packages import lambda_packages
print lambda_packages['psycopg2']['version']
# 2.6.1
print lambda_packages['psycopg2']['path']
# /home/YourUsername/.venvs/lambda_packages/psycopg2/psycopg2-2.6.1.tar.gzTo add support for more packages, send a pull request containing a gzipped tarball of the package (build on Amazon Linux and tested on AWS Lambda) in the appropriate directory, an updated manifest, and deterministic build instructions for creating the archive.
You may find the build.sh script useful as a starting point.
Building locally may be possible with docker. For example, to build numpy 1.11.3 you would run the following. Ensure that you are in the lambda-packages directory so that the container can have access to the build script.
docker run --rm -v $(pwd):/root -w /root mcrowson/lambda_package_builder /bin/bash build.sh numpy 1.11.3Useful targets include:
- MongoEngine
- pandas
- scipy
- scikit-learn
