The plugin for poetry that allows you to build zip packages suited for serverless deployment like AWS Lambda, Google App Engine, Azure App Service, and more...
Project description
Poetry Plugin Lambda Build
The plugin for poetry that allows you to build zip packages suited for serverless deployment like AWS Lambda, Google App Engine, Azure App Service, and more...
Additionally it provides docker container support for build inside container
Installation
poetry self add poetry-plugin-lambda-build
poetry self add poetry-plugin-export
Execution
Configure pyproject.toml
with the following configuration. This is example for AWS Lambda configuration
[tool.poetry-plugin-lambda-build]
docker_image = "public.ecr.aws/sam/build-python3.11:latest-x86_64"
docker_network = "host"
layer_artifact_name = "artifacts/layer.zip"
layer_install_dir = "lambda/python"
handler_artifact_name = "artifacts/handler.zip"
Running ...
poetry build-lambda
will build handler and layer packages for AWS Lambda deployment inside public.ecr.aws/sam/build-python3.11:latest-x86_64
container.
artifacts
├── handler.zip
└── layer.zip
Configuration Examples
AWS Lambda - all in one - dependencies and handler in the same zip package - Default
[tool.poetry-plugin-lambda-build]
artifact_name = "package.zip"
AWS Lambda - all in one - layer package
[tool.poetry-plugin-lambda-build]
install_dir = "lambda/python"
artifact_name = "layer.zip"
AWS Lambda - separated - separate layer package and handler package
[tool.poetry-plugin-lambda-build]
layer_artifact_name = "layer.zip"
layer_install_dir = "lambda/python"
handler_artifact_name = "handler.zip"
AWS Lambda - separated - separate layer package and handler package build in docker container
[tool.poetry-plugin-lambda-build]
docker_image = "public.ecr.aws/sam/build-python3.11:latest-x86_64"
docker_network = "host"
layer_artifact_name = "layer.zip"
layer_install_dir = "lambda/python"
handler_artifact_name = "handler.zip"
Tips
Mac users with Docker Desktops
Make sure to configure DOCKER_HOST
properly
export DOCKER_HOST=unix:///Users/$USER/.docker/run/docker.sock
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for poetry_plugin_lambda_build-0.1.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | eee92f920315d6c12ac3269c196f685243b8d6cdaffab2e476c6f17289e9c52a |
|
MD5 | a7f709adfd081dba35c3219e60792dfd |
|
BLAKE2b-256 | 62c7b510ec392b3b7f7ed9e13571c2e4afba3219c4d9ee160e7b481d3d48ae3d |
Hashes for poetry_plugin_lambda_build-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 259c757dda43ea9ac725c2219d02b064c0088e2188ff5f55220bd7e5381c8b02 |
|
MD5 | 4d3fa503c07de94e292677a2aa9e0ca6 |
|
BLAKE2b-256 | f25108332b73078662b937843e7159f15734829ac5908d46fc106567fcd7d888 |