You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To help deal with potentially large dependencies (for example: `numpy`, `scipy`
147
147
and `scikit-learn`) there is support for compressing the libraries. This does
148
-
require a minor change to your code to decompress them. To enable this add the
149
-
following to your `serverless.yml`:
148
+
require a minor change to your code to decompress them. To enable this add the
149
+
following to your `serverless.yml`:
150
150
151
151
```yaml
152
152
custom:
@@ -189,7 +189,7 @@ custom:
189
189
pythonRequirements:
190
190
slim: true
191
191
slimPatterns:
192
-
- "**/*.egg-info*"
192
+
- '**/*.egg-info*'
193
193
```
194
194
195
195
To overwrite the default patterns set the option `slimPatternsAppendDefaults` to `false` (`true` by default).
@@ -200,7 +200,7 @@ custom:
200
200
slim: true
201
201
slimPatternsAppendDefaults: false
202
202
slimPatterns:
203
-
- "**/*.egg-info*"
203
+
- '**/*.egg-info*'
204
204
```
205
205
206
206
This will remove all folders within the installed requirements that match
@@ -237,7 +237,7 @@ functions:
237
237
hello:
238
238
handler: handler.hello
239
239
layers:
240
-
- {Ref: PythonRequirementsLambdaLayer}
240
+
- {Ref: PythonRequirementsLambdaLayer}
241
241
```
242
242
243
243
If the layer requires additional or custom configuration, add them onto the `layer` option.
@@ -279,7 +279,7 @@ And second, a what we call "static caching" which caches output of pip after com
279
279
Since generally `requirements.txt` files rarely change, you will often see large amounts of speed improvements when enabling the static cache feature.
280
280
These caches will be shared between all your projects if no custom `cacheLocation` is specified (see below).
281
281
282
-
_**Please note:** This has replaced the previously recommended usage of "--cache-dir" in the pipCmdExtraArgs_
282
+
_**Please note:** This has replaced the previously recommended usage of "--cache-dir" in the pipCmdExtraArgs_
283
283
284
284
```yaml
285
285
custom:
@@ -290,7 +290,12 @@ custom:
290
290
291
291
### Other caching options
292
292
293
-
There are two additional options related to caching. You can specify where in your system that this plugin caches with the `cacheLocation` option. By default it will figure out automatically where based on your username and your OS to store the cache via the [appdirectory](https://www.npmjs.com/package/appdirectory) module. Additionally, you can specify how many max static caches to store with `staticCacheMaxVersions`, as a simple attempt to limit disk space usage for caching. This is DISABLED (set to 0) by default. Example:
293
+
There are two additional options related to caching.
294
+
You can specify where in your system that this plugin caches with the `cacheLocation` option.
295
+
By default it will figure out automatically where based on your username and your OS to store the cache via the [appdirectory](https://www.npmjs.com/package/appdirectory) module.
296
+
Additionally, you can specify how many max static caches to store with `staticCacheMaxVersions`, as a simple attempt to limit disk space usage for caching.
297
+
This is DISABLED (set to 0) by default.
298
+
Example:
294
299
295
300
```yaml
296
301
custom:
@@ -299,7 +304,6 @@ custom:
299
304
useDownloadCache: true
300
305
cacheLocation: '/home/user/.my_cache_goes_here'
301
306
staticCacheMaxVersions: 10
302
-
303
307
```
304
308
305
309
### Extra pip arguments
@@ -309,8 +313,8 @@ You can specify extra arguments [supported by pip](https://pip.pypa.io/en/stable
309
313
```yaml
310
314
custom:
311
315
pythonRequirements:
312
-
pipCmdExtraArgs:
313
-
- --compile
316
+
pipCmdExtraArgs:
317
+
- --compile
314
318
```
315
319
316
320
### Extra Docker arguments
@@ -321,8 +325,8 @@ You can specify extra arguments to be passed to [docker build](https://docs.dock
* Create a virtualenv and activate it while using serverless.
443
+
-Create a virtualenv and activate it while using serverless.
440
444
441
445
OR
442
446
443
-
* [Install Docker](https://docs.docker.com/docker-for-mac/install/) and use the [`dockerizePip` option](#cross-compiling).
447
+
-[Install Docker](https://docs.docker.com/docker-for-mac/install/) and use the [`dockerizePip` option](#cross-compiling).
444
448
445
449
Also, [brew seems to cause issues with pipenv](https://github.com/dschep/lambda-decorators/issues/4#event-1418928080),
446
450
so make sure you install pipenv using pip.
@@ -501,10 +505,10 @@ If you wish to exclude most of the files in your project, and only include the s
501
505
package:
502
506
individually: false
503
507
include:
504
-
- "./src/lambda_one/**"
505
-
- "./src/lambda_two/**"
508
+
- './src/lambda_one/**'
509
+
- './src/lambda_two/**'
506
510
exclude:
507
-
- "**"
511
+
- '**'
508
512
```
509
513
510
514
This will be very slow. Serverless adds a default `"**"` include. If you are using the `cacheLocation` parameter to this plugin, this will result in all of the cached files' names being loaded and then subsequently discarded because of the exclude pattern. To avoid this happening you can add a negated include pattern, as is observed in <https://github.com/serverless/serverless/pull/5825>.
@@ -515,37 +519,37 @@ Use this approach instead:
515
519
package:
516
520
individually: false
517
521
include:
518
-
- "!./**"
519
-
- "./src/lambda_one/**"
520
-
- "./src/lambda_two/**"
522
+
- '!./**'
523
+
- './src/lambda_one/**'
524
+
- './src/lambda_two/**'
521
525
exclude:
522
-
- "**"
526
+
- '**'
523
527
```
524
528
525
529
## Contributors
526
530
527
-
* [@dschep](https://github.com/dschep) - Lead developer & maintainer
-[@miketheman](https://github.com/miketheman) - fixing bug with includes when using zip option
542
+
-[@wattdave](https://github.com/wattdave) - fixing bug when using `deploymentBucket`
543
+
-[@heri16](https://github.com/heri16) - fixing Docker support in Windows
544
+
-[@ryansb](https://github.com/ryansb) - package individually support
545
+
-[@cgrimal](https://github.com/cgrimal) - Private SSH Repo access in Docker, `dockerFile` option
542
546
to build a custom docker image, real per-function requirements, and the `vendor` option
543
-
* [@kichik](https://github.com/kichik) - Imposed windows & `noDeploy` support,
547
+
-[@kichik](https://github.com/kichik) - Imposed windows & `noDeploy` support,
544
548
switched to adding files straight to zip instead of creating symlinks, and
545
549
improved pip cache support when using docker.
546
-
* [@dee-me-tree-or-love](https://github.com/dee-me-tree-or-love) - the `slim` package option
547
-
* [@alexjurkiewicz](https://github.com/alexjurkiewicz) - [docs about docker workflows](#native-code-dependencies-during-build)
548
-
* [@andrewfarley](https://github.com/andrewfarley) - Implemented download caching and static caching
549
-
* [@bweigel](https://github.com/bweigel) - adding the `slimPatternsAppendDefaults` option & fixing per-function packaging when some functions don't have requirements & Porting tests from bats to js!
* [@david-mk-lawrence](https://github.com/david-mk-lawrence) - added Lambda Layer support
550
+
-[@dee-me-tree-or-love](https://github.com/dee-me-tree-or-love) - the `slim` package option
551
+
-[@alexjurkiewicz](https://github.com/alexjurkiewicz) - [docs about docker workflows](#native-code-dependencies-during-build)
552
+
-[@andrewfarley](https://github.com/andrewfarley) - Implemented download caching and static caching
553
+
-[@bweigel](https://github.com/bweigel) - adding the `slimPatternsAppendDefaults` option & fixing per-function packaging when some functions don't have requirements & Porting tests from bats to js!
0 commit comments