How to exclude directories using include/exclude

hello all…I’m using

service: test
  package:
  include:
    - ../src/handler.py
    - ../libs/**

method of defining my package. This is working, but that method is including /src and /libs folders themselves in the zip.

For a python lambda function on AWS, lambda is looking in the root of the unzipped file for your handler and libs. So I want just handler.py and all my lib directories (without the parent /libs or /src folders) to be in the root of my deployment zip. How can I achieve this with serverless and AWS lambda/python functions?
thanks, in advance!

2 Likes

I’m also struggling with this.

Did you try exclude all like below. And then include the necessary files.

exclude:
    - ./**

did anyone solved this? i am also struggling with this. :roll_eyes:

11 Months and no-one has addressed this. :frowning: