JSPM

serverless-py-requirements

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

    Serverless Python Requirements Plugin

    Package Exports

    • serverless-py-requirements
    • serverless-py-requirements/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 (serverless-py-requirements) 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-pkg

    plugins:
      - sls-py-pkg
    custom:
      pythonRequirements:
        # These options are optional, only set them if you know what you're doing
        # excludeDefaults: false
        # cmd: pip install -r requirements.txt -r common_utils/requirements.txt -t .
        # pipArgs: >
        #   --index-url=https://pypi.org/simple
        #   --secondary-url=https://pypi.org/simple
        shared:
          common_utils:
            source: ../shared
            # if no functions specified, it will apply it to all
            functions:
              - hello
        exclude:
          - pyarrow/src
    
    functions:
      hello:
        module: .
        handler: handler.hello
        zip: true # the handler now has to unzip its own "requirements.zip"

    Note

    Duplicate modules are not supported, for good practices

    filter using the exclude options, don't use Packaging patterns

    In handler.py, shared code can be imported like this:

    from common_utils import shared_resource

    Future Features Coming Soon ™️ (maybe)


    • zip-imports
    • zip deeper deps filtering for pyc and pyo files

    Requirements


    • python & pip installed
    • minimum required node version >= 16