aws / chalice

Python Serverless Microframework for AWS
Apache License 2.0
10.61k stars 1.01k forks source link

Add option to compile dependencies if no wheel is found #1003

Open calz1 opened 5 years ago

calz1 commented 5 years ago

There are some popular libraries that require manual compiling/handling to get them to work with Lambda. It would be nice if Chalice automated the process of reliably building and packaging dependencies within an Amazon Linux Docker container kind of like the Serverless framework does:

https://serverless.com/blog/serverless-python-packaging/

Two that have caused me problems:

tedivm commented 5 years ago

Have you considered using the psycopg2-binrary package? It's a precompiled wheel bundled with all the relevant libraries.

calz1 commented 5 years ago

@tedivm That would definitely help, but requires knowing it exists and isn't as user-friendly as if the solution handled reliably packaging itself.

jamesls commented 5 years ago

I think it would be useful to have an optional backend to the packager that could integrate with docker to build your dependencies for you. Maybe something like:

$ chalice package --backend docker ./out

That way if you want a guaranteed way of packaging and don't mind installing/configuring docker you can use that, and if your set of dependencies all have a manylinux1 wheel available, you don't need docker.