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

Commit 8a6c1a9

Browse files
authored
Default noDeploy to an empty list (#312)
Default `noDeploy` to an empty list
2 parents e2516da + d540fa6 commit 8a6c1a9

File tree

4 files changed

+16
-53
lines changed

4 files changed

+16
-53
lines changed

README.md

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -207,18 +207,7 @@ custom:
207207
```
208208
## Omitting Packages
209209
You can omit a package from deployment with the `noDeploy` option. Note that
210-
dependencies of omitted packages must explicitly be omitted too. By default,
211-
the following packages are omitted as they are already installed on Lambda:
212-
213-
* boto3
214-
* botocore
215-
* docutils
216-
* jmespath
217-
* pip
218-
* python-dateutil
219-
* s3transfer
220-
* setuptools
221-
* six
210+
dependencies of omitted packages must explicitly be omitted too.
222211

223212
This example makes it instead omit pytest:
224213
```yaml
@@ -228,14 +217,6 @@ custom:
228217
- pytest
229218
```
230219

231-
To include the default omitted packages, set the `noDeploy` option to an empty
232-
list:
233-
```yaml
234-
custom:
235-
pythonRequirements:
236-
noDeploy: []
237-
```
238-
239220
## Extra Config Options
240221
### Caching
241222
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).

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
version: '{build}'
22
init:
3+
- cmd: python -m pip install -U pip
34
- cmd: pip install pipenv
45
- cmd: pip install poetry==1.0.0a2
56
- ps: npm i -g serverless

index.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,7 @@ class ServerlessPythonRequirements {
5353
cacheLocation: false,
5454
staticCacheMaxVersions: 0,
5555
pipCmdExtraArgs: [],
56-
noDeploy: [
57-
'boto3',
58-
'botocore',
59-
'docutils',
60-
'jmespath',
61-
'python-dateutil',
62-
's3transfer',
63-
'six',
64-
'pip',
65-
'setuptools'
66-
],
56+
noDeploy: [],
6757
vendor: ''
6858
},
6959
(this.serverless.service.custom &&

test.js

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ test('default pythonBin can package flask with default options', t => {
128128
sls(['package']);
129129
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
130130
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
131-
t.false(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is NOT packaged');
131+
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
132132
t.end();
133133
});
134134

@@ -139,7 +139,7 @@ test('py3.6 can package flask with default options', t => {
139139
sls([`--pythonBin=${getPythonBin(3)}`, 'package']);
140140
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
141141
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
142-
t.false(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is NOT packaged');
142+
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
143143
t.end();
144144
});
145145

@@ -248,9 +248,9 @@ test(
248248

249249
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
250250
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
251-
t.false(
251+
t.true(
252252
zipfiles.includes(`boto3${sep}__init__.py`),
253-
'boto3 is NOT packaged'
253+
'boto3 is packaged'
254254
);
255255
t.end();
256256
},
@@ -379,7 +379,7 @@ test('py2.7 can package flask with default options', t => {
379379
sls([`--pythonBin=${getPythonBin(2)}`, 'package']);
380380
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
381381
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
382-
t.false(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is NOT packaged');
382+
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
383383
t.end();
384384
});
385385

@@ -556,10 +556,7 @@ test(
556556

557557
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
558558
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
559-
t.false(
560-
zipfiles.includes(`boto3${sep}__init__.py`),
561-
'boto3 is NOT packaged'
562-
);
559+
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
563560
t.end();
564561
},
565562
{ skip: !canUseDocker() }
@@ -631,7 +628,7 @@ test('pipenv py3.6 can package flask with default options', t => {
631628
sls(['package']);
632629
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
633630
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
634-
t.false(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is NOT packaged');
631+
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
635632
t.end();
636633
});
637634

@@ -719,7 +716,7 @@ test('non build pyproject.toml uses requirements.txt', t => {
719716
sls(['package']);
720717
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
721718
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
722-
t.false(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is NOT packaged');
719+
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
723720
t.end();
724721
});
725722

@@ -730,7 +727,7 @@ test('poetry py3.6 can package flask with default options', t => {
730727
sls(['package']);
731728
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
732729
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
733-
t.false(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is NOT packaged');
730+
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
734731
t.end();
735732
});
736733

@@ -838,11 +835,11 @@ test('py3.6 can package lambda-decorators using vendor option', t => {
838835
sls([`--vendor=./vendor`, 'package']);
839836
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
840837
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
838+
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
841839
t.true(
842840
zipfiles.includes(`lambda_decorators.py`),
843841
'lambda_decorators.py is packaged'
844842
);
845-
t.false(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is NOT packaged');
846843
t.end();
847844
});
848845

@@ -867,15 +864,12 @@ test(
867864

868865
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
869866
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
867+
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
870868
t.true(
871869
zipfiles.includes(`lambda_decorators.py`),
872870
'lambda_decorators.py is packaged'
873871
);
874872
t.true(zipfiles.includes(`foobar`), 'foobar is packaged');
875-
t.false(
876-
zipfiles.includes(`boto3${sep}__init__.py`),
877-
'boto3 is NOT packaged'
878-
);
879873

880874
const zipfiles_with_metadata = listZipFilesWithMetaData(
881875
'.serverless/sls-py-req-test.zip'
@@ -906,7 +900,7 @@ test('py3.6 can package flask in a project with a space in it', t => {
906900
sls(['package']);
907901
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
908902
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
909-
t.false(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is NOT packaged');
903+
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
910904
t.end();
911905
});
912906

@@ -920,10 +914,7 @@ test(
920914
sls(['--dockerizePip=true', 'package']);
921915
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
922916
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
923-
t.false(
924-
zipfiles.includes(`boto3${sep}__init__.py`),
925-
'boto3 is NOT packaged'
926-
);
917+
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
927918
t.end();
928919
},
929920
{ skip: !canUseDocker() }

0 commit comments

Comments
 (0)