1212
1313
1414log = logging .getLogger (__name__ )
15- log .setLevel (logging .INFO )
1615
1716
1817def read_file (path , loader = None , binary_file = False ):
@@ -25,6 +24,39 @@ def read_file(path, loader=None, binary_file=False):
2524
2625def deploy_function (function_module , function_name_suffix = '' , package_objects = None ,
2726 requirements_fpath = None , extra_config = None , local_package = None ):
27+ """
28+ Creates or updates a lambda function given a `function_module` that is a
29+ python module containing a dictionary config and correct handler function.
30+ The name of the handler function must match the `function_handler` value
31+ in the config.
32+
33+ Overall, this function creates a temporary directory and installs the lambda
34+ service function, as well as supplied python modules and pip packages. This
35+ directory is compressed as a temporary zip file and used to create/update
36+ the lambda function.
37+
38+ Args:
39+ function_module (types.ModuleType):
40+ Python module containing the `config` dictionary and handler
41+ function necessary to deploy the lambda function. See an examples
42+ in aws_lambda.examples.
43+ function_name_suffix (str):
44+ If provided, will append the given string (with prepended "_" if
45+ not present) to the deployed lambda function name.
46+ package_objects (list):
47+ Optional list of Python packages (types.ModuleType) that will be
48+ explicitly added to the zipfile for lambda code. Use this argument
49+ as an alternative to pip installing packages.
50+ requirements_fpath (str): path to requirements.txt file to pip install.
51+ extra_config (dict):
52+ additional kwargs that will be passed to boto3 create_function
53+ or update_function_configuration for lambda client. Optionally use
54+ to override `Environment` or any other arguments.
55+ local_package (str): optional path to a Python repo to pip install.
56+
57+ Returns:
58+ None
59+ """
2860 # check provided function module and packages
2961 cfg = function_module .config
3062 function_fpath = function_module .__file__
0 commit comments