JSPM

sls-py-extern-pkgs

1.0.2
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • 0
    • Score
      100M100P100Q25241F

    Add external folders to the sls package and run commands

    Package Exports

    • sls-py-extern-pkgs
    • sls-py-extern-pkgs/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sls-py-extern-pkgs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    sls-py-extern-pkgs 📦

    serverless

    npm version

    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:
        # Your images here
        # TODO: Currently it doesn't work, but the packages are copied
    
    functions:
      # Your functions here
    
    custom:
      packageExternal:
        common_utils:
          # Optional command to run after you have linked common_utils
          cmd: pip install -r requirements.txt -t .. > /dev/null 2>&1
          source: '../common_utils'
          # if no functions specified, it will apply it to all
          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