Skip to content

Default noDeploy to an empty list #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,18 +207,7 @@ custom:
```
## Omitting Packages
You can omit a package from deployment with the `noDeploy` option. Note that
dependencies of omitted packages must explicitly be omitted too. By default,
the following packages are omitted as they are already installed on Lambda:

* boto3
* botocore
* docutils
* jmespath
* pip
* python-dateutil
* s3transfer
* setuptools
* six
dependencies of omitted packages must explicitly be omitted too.

This example makes it instead omit pytest:
```yaml
Expand All @@ -228,14 +217,6 @@ custom:
- pytest
```

To include the default omitted packages, set the `noDeploy` option to an empty
list:
```yaml
custom:
pythonRequirements:
noDeploy: []
```

## Extra Config Options
### Caching
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).
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: '{build}'
init:
- cmd: python -m pip install -U pip
- cmd: pip install pipenv
- cmd: pip install poetry==1.0.0a2
- ps: npm i -g serverless
Expand Down
12 changes: 1 addition & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,7 @@ class ServerlessPythonRequirements {
cacheLocation: false,
staticCacheMaxVersions: 0,
pipCmdExtraArgs: [],
noDeploy: [
'boto3',
'botocore',
'docutils',
'jmespath',
'python-dateutil',
's3transfer',
'six',
'pip',
'setuptools'
],
noDeploy: [],
vendor: ''
},
(this.serverless.service.custom &&
Expand Down
35 changes: 13 additions & 22 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ test('default pythonBin can package flask with default options', t => {
sls(['package']);
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
t.false(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is NOT packaged');
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
t.end();
});

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

Expand Down Expand Up @@ -248,9 +248,9 @@ test(

const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
t.false(
t.true(
zipfiles.includes(`boto3${sep}__init__.py`),
'boto3 is NOT packaged'
'boto3 is packaged'
);
t.end();
},
Expand Down Expand Up @@ -379,7 +379,7 @@ test('py2.7 can package flask with default options', t => {
sls([`--pythonBin=${getPythonBin(2)}`, 'package']);
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
t.false(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is NOT packaged');
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
t.end();
});

Expand Down Expand Up @@ -556,10 +556,7 @@ test(

const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
t.false(
zipfiles.includes(`boto3${sep}__init__.py`),
'boto3 is NOT packaged'
);
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
t.end();
},
{ skip: !canUseDocker() }
Expand Down Expand Up @@ -631,7 +628,7 @@ test('pipenv py3.6 can package flask with default options', t => {
sls(['package']);
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
t.false(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is NOT packaged');
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
t.end();
});

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

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

Expand Down Expand Up @@ -838,11 +835,11 @@ test('py3.6 can package lambda-decorators using vendor option', t => {
sls([`--vendor=./vendor`, 'package']);
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
t.true(
zipfiles.includes(`lambda_decorators.py`),
'lambda_decorators.py is packaged'
);
t.false(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is NOT packaged');
t.end();
});

Expand All @@ -867,15 +864,12 @@ test(

const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
t.true(
zipfiles.includes(`lambda_decorators.py`),
'lambda_decorators.py is packaged'
);
t.true(zipfiles.includes(`foobar`), 'foobar is packaged');
t.false(
zipfiles.includes(`boto3${sep}__init__.py`),
'boto3 is NOT packaged'
);

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

Expand All @@ -920,10 +914,7 @@ test(
sls(['--dockerizePip=true', 'package']);
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
t.false(
zipfiles.includes(`boto3${sep}__init__.py`),
'boto3 is NOT packaged'
);
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
t.end();
},
{ skip: !canUseDocker() }
Expand Down