[docs]defstep_3_2_run_poetry_install(self):""" Execute Poetry installation with lock file constraints. Runs Poetry install with --no-root to exclude the project package itself, installing only dependencies into an in-project virtual environment. """self.log("--- Step 3.2 - Run 'poetry install'")path_bin_poetry=self.path_bin_poetrydir_repo=self.path_layout.dir_repowithtemp_cwd(dir_repo):self.log("--- Run 'poetry config virtualenvs.in-project true'")args=[f"{path_bin_poetry}","config","virtualenvs.in-project","true",]subprocess.run(args,cwd=dir_repo,check=True)self.log("--- Run 'poetry install --no-root'")args=[f"{path_bin_poetry}","install","--no-root",]subprocess.run(args,cwd=dir_repo,check=True)
[docs]@dataclasses.dataclass(frozen=True)classPoetryBasedLambdaLayerContainerBuilder(BasedLambdaLayerContainerBuilder,):""" Command class for containerized Poetry-based Lambda layer builds. .. seealso:: :class:`~aws_lambda_artifact_builder.layer.builder.BasedLambdaLayerContainerBuilder` """path_script:Path=dataclasses.field(default=path_build_lambda_layer_using_poetry_in_container_script)
[docs]defstep_1_preflight_check(self):super().step_1_preflight_check()ifself.path_layout.path_poetry_lock.exists()isFalse:raiseFileNotFoundError(f"Poetry lock file not found: {self.path_layout.path_poetry_lock},"f"cannot proceed with poetry-based build."f"Please run 'poetry lock' to generate the lock file.")