Skip to content

AWS Lambda precomiled binaries for lxml 3.6.4 built for python 2.7 and python 3.6 runtimes

License

Notifications You must be signed in to change notification settings

pcastelog/aws-lambda-lxml

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aws-lambda-lxml

AWS Lambda precomiled binaries for lxml built for python 2.7 and python 3.6 runtimes.

libxml2-dev and libxslt-dev are not needed as they are included by default in the machines that run lambdas.

Example usage

  1. Put the lxml directory in the root of your lambda package
  2. Import lxml and use as usual
from lxml import etree


def handle(event, context):
    return etree.fromstring(event)

Build it yourself

The lxml library is os dependent thus we need to have precompiled copy. Below are the steps.

Create a docker container. docker run -it lambci/lambda:build-python3.8 bash

Create a dir named ‘lib'(anything you want) and Install lxml into it. mkdir lib pip install lxml -t ./lib --no-deps

Open another cmd and run docker ps

copy the containerid

Copy the files from container to host.

mkdir /home/libraries/opt/python/lib/python3.8/site-packages/
docker cp <containerid>:/var/task/lib /home/libraries/opt/python/lib/python3.8/site-packages/

Steps taken from https://codeutility.org/python-aws-lambda-not-importing-lxml-stack-overflow/

Once you run this, you'll have a folder called lxml (you can ignore the other one with the dist-info), which is the one you are going to place in the root of the lambda package as specified in the example

About

AWS Lambda precomiled binaries for lxml 3.6.4 built for python 2.7 and python 3.6 runtimes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 43.8%
  • Python 25.7%
  • XSLT 16.8%
  • Cython 13.7%