sls-py-extern-pkgs 📦
Package a Serverless Python Function services with external code
Installation
npm i -D sls-py-extern-pkgs
yarn add -D sls-py-extern-pkgs
Usage
service: service-name
plugins:
- serverless-package-external
ecr:
images:
functions:
custom:
packageExternal:
common_utils:
cmd: pip install -r requirements.txt -t .. > /dev/null 2>&1
source: '../common_utils'
functions:
- service-a
- service-b
api_utils:
source: '../api_utils'
functions:
- service-b
Example Directory Structure
└── common_utils
└── resource.py
└── api_utils
└── resource.py
└── functions
└── service-a
└── handler.py
└── service-b
└── handler.py
serverless.yml
In service-b/handler.py, external code can be imported:
from common_utils.resource import shared_resource
from api_utils.resource import shared_resource