Skip to content

Commit

Permalink
add python 3.8 support
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpeteuil committed May 9, 2020
1 parent a535490 commit 5db3319
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Robert Peteuil
Copyright (c) 2020 Robert Peteuil

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Creates an AWS Lambda Layers zip file that is **optimized** for: [Lambda Layer d
This function was created to address these issues:

- Many methods of creating Lambda zip files for Python functions don't work for Lambda Layers
- This is due to the fact Lambda Layers require specific library paths within the zip, where regular Lambda zips dont
- This is due to the fact Lambda Layers require specific library paths within the zip, unlike regular Lambda zip files
- Compiled dependancies must be created in an environment that matches the Lambda runtime
- Reduce size of zip file by removing unnecessary libraries and files

Expand All @@ -16,7 +16,7 @@ This function was created to address these issues:
- Builds zip file containing Python dependancies and places the libraries into the proper directory structure for lambda layers
- Ensures compiled libraries are compatible with Lambda environment by using [docker container](https://hub.docker.com/r/lambci/lambda) that mimics the lambda runtime environment
- Optimized the zip size by removing `.pyc` files and unnecessary libraries
- allows specifying lambda supported python versions: 2.7, 3.6 and 3.7
- allows specifying lambda supported python versions: 2.7, 3.6, 3.7 and 3.8
- Automatically searches for requirements.txt file in several locations:
- same directory as script
- parent directory or script (useful when used as submodule)
Expand Down Expand Up @@ -51,7 +51,7 @@ git submodule update --init --recursive --remote
- parent directory of script (useful when used as submodule)
- function sub-directory of the parent directory (useful when used as submodule)
- Optionally specify Python Version
- `-p PYTHON_VER` - specifies the Python version: 2.7, 3.6, 3.7 (default 3.6)
- `-p PYTHON_VER` - specifies the Python version: 2.7, 3.6, 3.7, 3.8 (default 3.7)

## Reference - remove submodule

Expand Down
4 changes: 2 additions & 2 deletions _make_zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ set -e
# /python/lib/pythonX.X/site-packages

scriptname=$(basename "$0")
scriptbuildnum="1.0.0"
scriptbuilddate="2019-03-30"
scriptbuildnum="1.0.1"
scriptbuilddate="2020-05-08"

### VARS
CURRENT_DIR=$(reldir=$(dirname -- "$0"; echo x); reldir=${reldir%?x}; cd -- "$reldir" && pwd && echo x); CURRENT_DIR=${CURRENT_DIR%?x}
Expand Down
10 changes: 5 additions & 5 deletions build_layer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ set -e
# Zip filename includes python version used in its creation

scriptname=$(basename "$0")
scriptbuildnum="1.0.0"
scriptbuilddate="2019-03-30"
scriptbuildnum="1.0.1"
scriptbuilddate="2020-05-08"

# used to set destination of zip
SUBDIR_MODE=""
Expand All @@ -24,7 +24,7 @@ displayVer() {
usage() {
[[ "$1" ]] && echo -e "AWS Lambda Layer Zip Builder for Python Libraries\n"
echo -e "usage: ${scriptname} [-p PYTHON_VER] [-s] [-r REQUIREMENTS-DIR] [-h] [-v]"
echo -e " -p PYTHON_VER\t: Python version to use: 2.7, 3.6, 3.7 (default 3.6)"
echo -e " -p PYTHON_VER\t: Python version to use: 2.7, 3.6, 3.7, 3.8 (default 3.7)"
echo -e " -h\t\t\t: help"
echo -e " -v\t\t\t: display ${scriptname} version"
}
Expand All @@ -40,8 +40,8 @@ while getopts ":p:hv" arg; do
done
shift $((OPTIND-1))

# default Python to 3.6 if not set by CLI params
PYTHON_VER="${PYTHON_VER:-3.6}"
# default Python to 3.7 if not set by CLI params
PYTHON_VER="${PYTHON_VER:-3.7}"

CURRENT_DIR=$(reldir=$(dirname -- "$0"; echo x); reldir=${reldir%?x}; cd -- "$reldir" && pwd && echo x); CURRENT_DIR=${CURRENT_DIR%?x}
BASE_DIR=$(basename $CURRENT_DIR)
Expand Down

0 comments on commit 5db3319

Please sign in to comment.