How does pattern work when packaging

Hello,

I am struggling to create a package for my app, I would think that if I specify a pattern, only files that match that pattern would be in my package, but that is not what is happening. Do I have to explicitly define what to exclude as well?

I am forced to use a very old version of serverless as well, so what I am looking for is an explanation. I have read Serverless Framework - Packaging .

This is the package portion of my serverless.yml file (I have changed the names to obfuscate the actual app name)

package:  
  patterns:  
    - 'myapp/**'
    - 'second_src_dir/**'
    - '!myapp/subdir/tests.py'
    - '!myapp/subdir/test_data/**'  
  excludeDevDependencies: true

I have googled a fair amount and I also see examples in the format

package:  
  include:  
    - 'myapp/**'
    - 'second_src_dir/**'
  exclude:  
    - '!myapp/subdir/tests.py'
    - '!myapp/subdir/test_data/**'   
  excludeDevDependencies: true

but, since that format is not documented I imagine it is legacy or deprecated.

Either way, when I run serverless package the package includes everything in the repo root where serverless.yml is.

I tried adding

- '!**' 

as the first pattern, but when I do that the layer I am creating later errors out with

Error:
No file matches include / exclude patterns

I have been looking for documentation on exactly what ** does but have not found a useful definition.

Is the syntax for include and exclude different than that for patterns?

I am also using the Serverless Python Requirements - Serverless Framework: Plugins plugin.