kraken.std.aws
kraken.std.aws.lambda_
python_lambda_zip
python_lambda_zip(
name: str,
outfile: str | Path | None = None,
project_directory: (
Path | None | Literal["ignore"]
) = None,
include: Sequence[str | Path] = (),
include_data: Sequence[str | Include] = (),
packages: Sequence[str] = (),
requirements: str | Path | None = None,
python_version: str | None = None,
platform: PythonPlatform | None = None,
quiet: bool = False,
symlink_result: bool = True,
) -> BuildPythonLambdaZipTask
Create a task to build a Python AWS Lambda deployment package.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the task. |
required |
outfile
|
str | Path | None
|
The output file path for the ZIP archive. If not specified, the archive will be placed in the build directory with the name "{name}.zip". |
None
|
project_directory
|
Path | None | Literal['ignore']
|
The path to the Python project directory. If set to "ignore", the project directory will not be included. If None and a project configuration file is found in the current directory, that directory will be used. |
None
|
include
|
Sequence[str | Path]
|
A sequence of files or directories to include in the ZIP archive. Each item can be a string in the format "source:dest" or just "source" (which will use the basename as the destination). |
()
|
include_data
|
Sequence[str | Include]
|
A sequence of paths with an optional rename to include in the ZIP archive. Each item can be an Include object or a string in the format "source:dest". |
()
|
packages
|
Sequence[str]
|
A sequence of Python packages to install in the Lambda environment. |
()
|
requirements
|
str | Path | None
|
A path to a requirements file containing Python packages to install. |
None
|
python_version
|
str | None
|
The Python version to use for the Lambda function. |
None
|
platform
|
PythonPlatform | None
|
The target platform for the Lambda function. |
None
|
quiet
|
bool
|
If True, suppress output from the build process. |
False
|
symlink_result
|
bool
|
If True, symlink the resulting ZIP archive to the specified outfile. If False, copy the file instead. |
True
|
Returns:
Type | Description |
---|---|
BuildPythonLambdaZipTask
|
A task that, when executed, builds the Python Lambda deployment package. |
Raises:
Type | Description |
---|---|
ValueError
|
If an invalid platform is specified. |