Deploy a Serverless Python Function services with external code
Before deploying, this plugin symlinks folders containing shared code into the root directory of your Serverless function.
This plugin works also with serverless-offline
plugin.
npm i serverless-package-external --save-dev
service: service-name
plugins:
- serverless-package-external
functions:
# Your functions here
custom:
packageExternal:
external:
- '../common'
- '../service-a/module'
βββ common
βββ resource.py
βββ service-a
βββ handler.py
βββ serverless.yml
βββ module
βββ main.py
βββ service-b
βββ handler.py
βββ serverless.yml
In handler.py, external code can be imported:
from common.resource import shared_resource
serverless-package-external is licensed under the MIT License.
It is originally based on serverless-package-common.