Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Flattening noDeploy arrays from external files #423

@MMuthukrishna

Description

@MMuthukrishna

serverless-python-requirements enables packaging large python libraries in layers and specifying them in noDeploy so as to avoid redeploying these large libraries along with the functions as shown here.

I have a file containing the layer arn and noDeploy for such libraries in a file and I would like to make every other lambda function refer to that file.

Example of such a file - python_req.yml -

pandas:
    arn: <---->
    noDeploy:
      - numpy
      - pandas
      - python-dateutil
      - pytz
      - six
requests:
    arn: <---->
    noDeploy:
      - certifi
      - chardet
      - idna
      - requests
      - urllib3

Assuming python_req.yml exists a level above a folder named my-sample with a function hello to which I have added the following layers

layers:
  - ${file(../python-req.yml):pandas.arn}
  - ${file(../python-req.yml):requests.arn}

I would like to also combine the noDeploy list of pandas and requests

custom:
  pythonRequirements:
    dockerizePip: non-linux
    noDeploy:
      - ${file(../python-req.yml):pandas.noDeploy}
      - ${file(../python-req.yml):requests.noDeploy}

doing this makes custom.pythonRequirements.noDeploy an array of arrays
[['numpy', 'pandas', 'python-dateutil', 'pytz', 'six'], ['certifi', 'chardet', 'idna', 'requests', 'urllib3']]

and serverless-python-requirements expects noDeploy to be an array and packages all these dependencies along with the function instead of ignoring them

Is there a way flatten arrays referenced from external file in serverless.yml or a way to make serverless-python-requirements parse array of arrays for noDeploy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions