Skip to content

Commit 6e74eac

Browse files
authored
Merge pull request nficano#85 from karthich/feature/Issue-83
Issue: nficano#83
2 parents fe6548d + a79187e commit 6e74eac

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

aws_lambda/aws_lambda.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def cleanup_old_versions(src, keep_last_versions, config_file='config.yaml'):
7979

8080

8181
def deploy(
82-
src, requirements=False, local_package=None,
82+
src, use_requirements=False, local_package=None,
8383
config_file='config.yaml',
8484
):
8585
"""Deploys a new function to AWS Lambda.
@@ -101,7 +101,7 @@ def deploy(
101101
# directory.
102102
path_to_zip_file = build(
103103
src, config_file=config_file,
104-
requirements=requirements,
104+
use_requirements=use_requirements,
105105
local_package=local_package,
106106
)
107107

@@ -132,7 +132,7 @@ def deploy_s3(
132132
# Zip the contents of this folder into a single file and output to the dist
133133
# directory.
134134
path_to_zip_file = build(
135-
src, config_file=config_file, requirements=requirements,
135+
src, config_file=config_file, use_requirements=requirements,
136136
local_package=local_package,
137137
)
138138

@@ -145,7 +145,7 @@ def deploy_s3(
145145

146146

147147
def upload(
148-
src, requirements=False, local_package=None,
148+
src, use_requirements=False, local_package=None,
149149
config_file='config.yaml',
150150
):
151151
"""Uploads a new function to AWS S3.
@@ -166,7 +166,7 @@ def upload(
166166
# Zip the contents of this folder into a single file and output to the dist
167167
# directory.
168168
path_to_zip_file = build(
169-
src, config_file=config_file, requirements=requirements,
169+
src, config_file=config_file, use_requirements=use_requirements,
170170
local_package=local_package,
171171
)
172172

@@ -248,7 +248,7 @@ def init(src, minimal=False):
248248

249249

250250
def build(
251-
src, requirements=False, local_package=None, config_file='config.yaml',
251+
src, use_requirements=False, local_package=None, config_file='config.yaml',
252252
):
253253
"""Builds the file bundle.
254254
@@ -277,7 +277,7 @@ def build(
277277
path_to_temp = mkdtemp(prefix='aws-lambda')
278278
pip_install_to_target(
279279
path_to_temp,
280-
requirements=requirements,
280+
use_requirements=use_requirements,
281281
local_package=local_package,
282282
)
283283

@@ -396,13 +396,13 @@ def _filter_blacklist(package):
396396
pip.main(['install', package, '-t', path, '--ignore-installed'])
397397

398398

399-
def pip_install_to_target(path, requirements=False, local_package=None):
399+
def pip_install_to_target(path, use_requirements=False, local_package=None):
400400
"""For a given active virtualenv, gather all installed pip packages then
401401
copy (re-install) them to the path provided.
402402
403403
:param str path:
404404
Path to copy installed pip packages to.
405-
:param bool requirements:
405+
:param bool use_requirements:
406406
If set, only the packages in the requirements.txt file are installed.
407407
The requirements.txt file needs to be in the same directory as the
408408
project which shall be deployed.
@@ -413,7 +413,7 @@ def pip_install_to_target(path, requirements=False, local_package=None):
413413
well (and/or is not available on PyPi)
414414
"""
415415
packages = []
416-
if not requirements:
416+
if not use_requirements:
417417
print('Gathering pip packages')
418418
packages.extend(pip.operations.freeze.freeze())
419419
else:

scripts/lambda

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def init(folder, minimal):
3636

3737

3838
@click.command(help='Bundles package for deployment.')
39-
@click.option('--config-file', default=None, help='Alternate config file.')
39+
@click.option('--config-file', default='config.yaml', help='Alternate config file.')
4040
@click.option(
4141
'--use-requirements', default=False, is_flag=True,
4242
help='Install all packages defined in requirements.txt',
@@ -55,8 +55,8 @@ def build(use_requirements, local_package, config_file):
5555

5656

5757
@click.command(help='Run a local test of your function.')
58-
@click.option('--event-file', default=None, help='Alternate event file.')
59-
@click.option('--config-file', default=None, help='Alternate config file.')
58+
@click.option('--event-file', default='event.json', help='Alternate event file.')
59+
@click.option('--config-file', default='config.yaml', help='Alternate config file.')
6060
@click.option('--verbose', '-v', is_flag=True)
6161
def invoke(event_file, config_file, verbose):
6262
aws_lambda.invoke(
@@ -68,7 +68,7 @@ def invoke(event_file, config_file, verbose):
6868

6969

7070
@click.command(help='Register and deploy your code to lambda.')
71-
@click.option('--config-file', default=None, help='Alternate config file.')
71+
@click.option('--config-file', default='config.yaml', help='Alternate config file.')
7272
@click.option(
7373
'--use-requirements', default=False, is_flag=True,
7474
help='Install all packages defined in requirements.txt',
@@ -100,7 +100,7 @@ def upload(use_requirements, local_package):
100100

101101

102102
@click.command(help='Deploy your lambda via S3.')
103-
@click.option('--config-file', default=None, help='Alternate config file.')
103+
@click.option('--config-file', default='config.yaml', help='Alternate config file.')
104104
@click.option(
105105
'--use-requirements', default=False, is_flag=True, help=(
106106
'Install all packages defined in requirements.txt'
@@ -119,7 +119,7 @@ def deploy_s3(use_requirements, local_package, config_file):
119119

120120

121121
@click.command(help='Delete old versions of your functions')
122-
@click.option('--config-file', default=None, help='Alternate config file.')
122+
@click.option('--config-file', default='config.yaml', help='Alternate config file.')
123123
@click.option(
124124
'--keep-last', type=int, prompt=(
125125
'Please enter the number of recent versions to keep'

0 commit comments

Comments
 (0)