Skip to content
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
20 changes: 10 additions & 10 deletions aws_lambda/aws_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def cleanup_old_versions(src, keep_last_versions, config_file='config.yaml'):


def deploy(
src, requirements=False, local_package=None,
src, use_requirements=False, local_package=None,
config_file='config.yaml',
):
"""Deploys a new function to AWS Lambda.
Expand All @@ -101,7 +101,7 @@ def deploy(
# directory.
path_to_zip_file = build(
src, config_file=config_file,
requirements=requirements,
use_requirements=use_requirements,
local_package=local_package,
)

Expand Down Expand Up @@ -132,7 +132,7 @@ def deploy_s3(
# Zip the contents of this folder into a single file and output to the dist
# directory.
path_to_zip_file = build(
src, config_file=config_file, requirements=requirements,
src, config_file=config_file, use_requirements=requirements,
local_package=local_package,
)

Expand All @@ -145,7 +145,7 @@ def deploy_s3(


def upload(
src, requirements=False, local_package=None,
src, use_requirements=False, local_package=None,
config_file='config.yaml',
):
"""Uploads a new function to AWS S3.
Expand All @@ -166,7 +166,7 @@ def upload(
# Zip the contents of this folder into a single file and output to the dist
# directory.
path_to_zip_file = build(
src, config_file=config_file, requirements=requirements,
src, config_file=config_file, use_requirements=use_requirements,
local_package=local_package,
)

Expand Down Expand Up @@ -248,7 +248,7 @@ def init(src, minimal=False):


def build(
src, requirements=False, local_package=None, config_file='config.yaml',
src, use_requirements=False, local_package=None, config_file='config.yaml',
):
"""Builds the file bundle.

Expand Down Expand Up @@ -277,7 +277,7 @@ def build(
path_to_temp = mkdtemp(prefix='aws-lambda')
pip_install_to_target(
path_to_temp,
requirements=requirements,
use_requirements=use_requirements,
local_package=local_package,
)

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


def pip_install_to_target(path, requirements=False, local_package=None):
def pip_install_to_target(path, use_requirements=False, local_package=None):
"""For a given active virtualenv, gather all installed pip packages then
copy (re-install) them to the path provided.

:param str path:
Path to copy installed pip packages to.
:param bool requirements:
:param bool use_requirements:
If set, only the packages in the requirements.txt file are installed.
The requirements.txt file needs to be in the same directory as the
project which shall be deployed.
Expand All @@ -413,7 +413,7 @@ def pip_install_to_target(path, requirements=False, local_package=None):
well (and/or is not available on PyPi)
"""
packages = []
if not requirements:
if not use_requirements:
print('Gathering pip packages')
packages.extend(pip.operations.freeze.freeze())
else:
Expand Down
12 changes: 6 additions & 6 deletions scripts/lambda
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def init(folder, minimal):


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


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


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


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


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