File size: 931 Bytes
d8ad0fd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | from abc import ABC, abstractmethod
from pathlib import Path
class BaseLocalLambdaLayer(ABC):
def __init__(self, output_dir: Path):
self.output_dir = output_dir / "layer_build"
self.target_dir = f"{self.output_dir}/python"
@abstractmethod
def build(self) -> str:
"""Builds a Lambda Layer locally
Returns
-------
build_path : str
Path where newly built Lambda Layer is
"""
raise NotImplementedError()
def before_build(self):
"""Any step to run before build process begins.
By default, it creates output dir and its parents if it doesn't exist.
"""
if not self.output_dir.exists():
# Create missing parent directories if missing
self.output_dir.mkdir(parents=True, exist_ok=True)
def after_build(self): # noqa: B027
"""Any step after a build succeed"""
...
|