diff --git a/README.md b/README.md index 826c960a7..c2a6a0ef0 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,7 @@ to change Zappa's behavior. Use these at your own risk! }], "domain": "yourapp.yourdomain.com", // Required if you're using a domain "exclude": ["*.gz", "*.pem"], // A list of regex patterns to exclude from the archive + "exclude_conda_packages": ["boto3","botocore","pip","python","readline","sqlite","wheel"] // When using conda, a list of conda packages to remove before zipping. "http_methods": ["GET", "POST"], // HTTP Methods to route, "integration_response_codes": [200, 301, 404, 500], // Integration response status codes to route "keep_warm": true, // Create CloudWatch events to keep the server warm. @@ -172,7 +173,7 @@ to change Zappa's behavior. Use these at your own risk! "vpc_config": { // Optional VPC configuration for Lambda function "SubnetIds": [ "subnet-12345678" ], // Note: not all availability zones support Lambda! "SecurityGroupIds": [ "sg-12345678" ] - } + }, } } ``` diff --git a/zappa/cli.py b/zappa/cli.py index a684e07fa..7a60f8ecf 100644 --- a/zappa/cli.py +++ b/zappa/cli.py @@ -450,7 +450,9 @@ def create_package(self): self.lambda_name, handler_file=handler_file, use_precompiled_packages=self.zappa_settings[self.api_stage].get('use_precompiled_packages', True), - exclude=self.zappa_settings[self.api_stage].get('exclude', []) + exclude=self.zappa_settings[self.api_stage].get('exclude', []), + exclude_conda_packages = self.zappa_settings[self.api_stage].get('exclude_conda_packages', + ['pip','python','readline','sqlite','wheel', 'boto3', 'botocore']) ) # Throw our setings into it diff --git a/zappa/zappa.py b/zappa/zappa.py index cbe08dcb2..fc7cf4e3d 100755 --- a/zappa/zappa.py +++ b/zappa/zappa.py @@ -179,8 +179,6 @@ ZIP_EXCLUDES = ['*.exe', '*.DS_Store', '*.Python', '*.git', '*.zip', '*.tar.gz','*.hg'] -STANDARD_CONDA_PACKAGES = ['openssl','pip','python','readline','sqlite','wheel', 'boto3', 'botocore'] - ## # Classes ## @@ -239,7 +237,8 @@ def __init__(self, boto_session=None, profile_name=None): ## def create_lambda_zip(self, prefix='lambda_package', handler_file=None, - minify=True, exclude=None, use_precompiled_packages=True, include=None, venv=None, exclude_conda_packages=STANDARD_CONDA_PACKAGES): + minify=True, exclude=None, use_precompiled_packages=True, include=None, venv=None, + exclude_conda_packages=[]): """ Creates a Lambda-ready zip file of the current virtualenvironment and working directory. @@ -327,7 +326,8 @@ def splitpath(path): excludes = ZIP_EXCLUDES + exclude shutil.copytree(conda_env, temp_package_path, symlinks=True, ignore=shutil.ignore_patterns(*excludes)) # Use conda cli to remove standard packages like python, pip, ... - subprocess.call(['conda','remove','-p',temp_package_path,'--force','--yes']+exclude_conda_packages) + if len(exclude_conda_packages): + subprocess.call(['conda','remove','-p',temp_package_path,'--force','--yes']+exclude_conda_packages) else: shutil.copytree(conda_env, temp_package_path, symlinks=True)