aws_lambda_python_packager package¶
Subpackages¶
Submodules¶
aws_lambda_python_packager.arrow_fetcher module¶
-
aws_lambda_python_packager.arrow_fetcher.fetch_arrow_package(output_dir: str | Path, package_version: str, python_version=
'3.9'
, arch='x86_64'
)[source]¶
- aws_lambda_python_packager.arrow_fetcher.get_arrow_version(arrow_version: str, python_version: str, arch: str) str | None [source]¶
- aws_lambda_python_packager.arrow_fetcher.open_zip_file(url: object) Generator[TarFile, None, None] [source]¶
aws_lambda_python_packager.dep_analyzer module¶
-
class aws_lambda_python_packager.dep_analyzer.DepAnalyzer(project_root: str | PathLike | None, python_version: str =
'3.9'
, architecture: str ='x86_64'
, region: str ='us-east-1'
, ignore_packages=False
, update_dependencies=False
, additional_packages_to_ignore: dict | None =None
)[source]¶ Bases:
ABC
- property extra_lines¶
- get_requirements() Iterable[PackageInfo | ExtraLine] [source]¶
- property pkgs_to_ignore¶
- property pkgs_to_ignore_dict¶
- property pkgs_to_ignore_info¶
- classmethod process_requirements(requirements: Iterable[str]) Iterable[PackageInfo | ExtraLine] [source]¶
- property requirements : dict[str, aws_lambda_python_packager.dep_analyzer.PackageInfo]¶
- class aws_lambda_python_packager.dep_analyzer.PackageInfo(name, version, version_spec)¶
Bases:
tuple
Create new instance of PackageInfo(name, version, version_spec)
- name¶
Alias for field number 0
- version¶
Alias for field number 1
- version_spec¶
Alias for field number 2
aws_lambda_python_packager.lambda_packager module¶
AWS Lambda Packager
This script is used to package the lambda function code into a zip file. It is an alternative to sam build and uses poetry to manage dependencies.
-
class aws_lambda_python_packager.lambda_packager.LambdaPackager(project_path: str | PathLike, output_dir: str | PathLike, python_version: str =
'3.9'
, architecture: str ='x86_64'
, region: str ='us-east-1'
, update_dependencies: bool =False
, ignore_packages: bool =False
, split_layer: bool =False
, additional_packages_to_ignore: dict | None =None
, ignore_unsupported_python: bool =True
)[source]¶ Bases:
object
Initialize the Lambda Packager
- Parameters:¶
- project_path: str | PathLike¶
Path to the pyproject.toml file
- python_version: str =
'3.9'
¶ Python version to target
- architecture: str =
'x86_64'
¶ Architecture to target (x86_64 or arm64)
- region: str =
'us-east-1'
¶ AWS region to target
- update_dependencies: bool =
False
¶ whether to update pyproject.toml with the appropriate versions of packages from the AWS lambda environment (ignored if ignore_packages is False)
- ignore_packages: bool =
False
¶ Ignore packages that already exist in the AWS lambda environment
- exception aws_lambda_python_packager.lambda_packager.UnsupportedVersionException[source]¶
Bases:
Exception
aws_lambda_python_packager.pip_analyzer module¶
-
class aws_lambda_python_packager.pip_analyzer.PipAnalyzer(project_root: str | PathLike | None, python_version: str =
'3.9'
, architecture: str ='x86_64'
, region: str ='us-east-1'
, ignore_packages=False
, update_dependencies=False
, additional_packages_to_ignore: dict | None =None
)[source]¶ Bases:
DepAnalyzer
- property extra_lines¶
aws_lambda_python_packager.poetry_analyzer module¶
-
class aws_lambda_python_packager.poetry_analyzer.PoetryAnalyzer(project_root: str | PathLike | None, python_version: str =
'3.9'
, architecture: str ='x86_64'
, region: str ='us-east-1'
, ignore_packages=False
, update_dependencies=False
, additional_packages_to_ignore: dict | None =None
)[source]¶ Bases:
DepAnalyzer
aws_lambda_python_packager.util module¶
-
aws_lambda_python_packager.util.get_python_runtime(architecture=
'x86_64'
, target_version=None
)[source]¶ Gets an allowed python runtime for the given architecture