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
Copy file name to clipboardExpand all lines: README.md
+36-17
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ This will automatically add the plugin to your project's `package.json` and the
21
21
`serverless.yml`. That's all that's needed for basic use! The plugin will now bundle your python
22
22
dependencies specified in your `requirements.txt` or `Pipfile` when you run `sls deploy`.
23
23
24
-
For a more in depth introduction on how to user this plugin, check out
24
+
For a more in depth introduction on how to user this plugin, check out
25
25
[this post on the Serverless Blog](https://serverless.com/blog/serverless-python-packaging/)
26
26
27
27
If you're on a mac, check out [these notes](#applebeersnake-mac-brew-installed-python-notes) about using python installed by brew.
@@ -113,17 +113,17 @@ except ImportError:
113
113
pass
114
114
```
115
115
### Slim Package
116
-
_Works on non 'win32' environments: Docker, WSL are included_
117
-
To remove the tests, information and caches from the installed packages,
118
-
enable the `slim` option. This will: `strip`the `.so` files, remove `__pycache__`
119
-
and `dist-info` directories as well as `.pyc` and `.pyo` files.
116
+
_Works on non 'win32' environments: Docker, WSL are included_
117
+
To remove the tests, information and caches from the installed packages,
118
+
enable the `slim` option. This will: `strip`the `.so` files, remove `__pycache__`
119
+
and `dist-info` directories as well as `.pyc` and `.pyo` files.
120
120
```yaml
121
121
custom:
122
122
pythonRequirements:
123
123
slim: true
124
-
```
125
-
#### Custom Removal Patterns
126
-
To specify additional directories to remove from the installed packages,
124
+
```
125
+
#### Custom Removal Patterns
126
+
To specify additional directories to remove from the installed packages,
127
127
define a list of patterns in the serverless config using the `slimPatterns`
128
128
option and glob syntax. These paterns will be added to the default ones (`**/*.py[c|o]`, `**/__pycache__*`, `**/*.dist-info*`).
129
129
Note, the glob syntax matches against whole paths, so to match a file in any
@@ -134,7 +134,7 @@ custom:
134
134
slim: true
135
135
slimPatterns:
136
136
- "**/*.egg-info*"
137
-
```
137
+
```
138
138
To overwrite the default patterns set the option `slimPatternsAppendDefaults` to `false` (`true` by default).
139
139
```yaml
140
140
custom:
@@ -143,21 +143,40 @@ custom:
143
143
slimPatternsAppendDefaults: false
144
144
slimPatterns:
145
145
- "**/*.egg-info*"
146
-
```
147
-
This will remove all folders within the installed requirements that match
148
-
the names in `slimPatterns`
149
-
## Omitting Packages
146
+
```
147
+
This will remove all folders within the installed requirements that match
148
+
the names in `slimPatterns`
149
+
## Omitting Packages
150
150
You can omit a package from deployment with the `noDeploy` option. Note that
151
-
dependencies of omitted packages must explicitly be omitted too.
152
-
By default, this will not install the AWS SDKs that are already installed on
153
-
Lambda. This example makes it instead omit pytest:
151
+
dependencies of omitted packages must explicitly be omitted too. By default,
152
+
the following packages are omitted as they are already installed on Lambda:
153
+
154
+
* boto3
155
+
* botocore
156
+
* docutils
157
+
* jmespath
158
+
* pip
159
+
* python-dateutil
160
+
* s3transfer
161
+
* setuptools
162
+
* six
163
+
164
+
This example makes it instead omit pytest:
154
165
```yaml
155
166
custom:
156
167
pythonRequirements:
157
168
noDeploy:
158
169
- pytest
159
170
```
160
171
172
+
To include the default omitted packages, set the `noDeploy` option to an empty
173
+
list:
174
+
```yaml
175
+
custom:
176
+
pythonRequirements:
177
+
noDeploy: []
178
+
```
179
+
161
180
## Extra Config Options
162
181
### Caching
163
182
You can enable two kinds of caching with this plugin which are currently both DISABLED by default. First, a download cache that will cache downloads that pip needs to compile the packages. And second, a what we call "static caching" which caches output of pip after compiling everything for your requirements file. Since generally requirements.txt files rarely change, you will often see large amounts of speed improvements when enabling the static cache feature. These caches will be shared between all your projects if no custom cacheLocation is specified (see below).
0 commit comments