Skip to content

Commit 49df755

Browse files
ci: replace poetry with uv
1 parent e196e86 commit 49df755

File tree

1 file changed

+3
-45
lines changed

1 file changed

+3
-45
lines changed

tests/e2e/utils/lambda_layer/powertools_layer.py

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,11 @@
1616

1717
class LocalLambdaPowertoolsLayer(BaseLocalLambdaLayer):
1818
IGNORE_EXTENSIONS = ["pyc"]
19-
ARCHITECTURE_PLATFORM_MAPPING = {
20-
Architecture.X86_64.name: ("manylinux_2_17_x86_64", "manylinux_2_28_x86_64"),
21-
Architecture.ARM_64.name: ("manylinux_2_17_aarch64", "manylinux_2_28_aarch64"),
22-
}
2319

2420
def __init__(self, output_dir: Path = CDK_OUT_PATH, architecture: Architecture = Architecture.X86_64):
2521
super().__init__(output_dir)
26-
self.source_root = SOURCE_CODE_ROOT_PATH
27-
self.extras = "all,redis,datamasking"
28-
29-
self.platform_args = self._resolve_platform(architecture)
30-
self.build_args = f"{self.platform_args} --only-binary=:all: --upgrade"
22+
self.package = f"{SOURCE_CODE_ROOT_PATH}[all,redis,datamasking]"
23+
self.build_command = f"python -m pip install {self.package} --upgrade --target {self.target_dir}"
3124
self.cleanup_command = (
3225
f"rm -rf {self.target_dir}/boto* {self.target_dir}/s3transfer* && "
3326
f"rm -rf {self.target_dir}/*dateutil* {self.target_dir}/urllib3* {self.target_dir}/six* && "
@@ -42,23 +35,7 @@ def build(self) -> str:
4235
self.before_build()
4336

4437
if self._has_source_changed():
45-
# Build wheel first, then install with platform constraints
46-
dist_dir = self.source_root / "dist"
47-
subprocess.run(f"rm -rf {dist_dir}", shell=True, check=True)
48-
subprocess.run(
49-
f"python -m pip wheel {self.source_root} --no-deps -w {dist_dir}",
50-
shell=True,
51-
check=True,
52-
)
53-
54-
# Find the built wheel
55-
wheel_file = next(dist_dir.glob("*.whl"))
56-
57-
# Install the wheel with extras and platform constraints
58-
install_cmd = (
59-
f"python -m pip install '{wheel_file}[{self.extras}]' {self.build_args} --target {self.target_dir}"
60-
)
61-
subprocess.run(install_cmd, shell=True, check=True)
38+
subprocess.run(self.build_command, shell=True, check=True)
6239

6340
self.after_build()
6441

@@ -82,22 +59,3 @@ def _has_source_changed(self) -> bool:
8259
return True
8360

8461
return False
85-
86-
def _resolve_platform(self, architecture: Architecture) -> str:
87-
"""Returns the correct pip platform tag argument for the manylinux project (see PEP 599)
88-
89-
Returns
90-
-------
91-
str
92-
pip's platform argument, e.g., --platform manylinux_2_17_x86_64 --platform manylinux_2_28_x86_64
93-
"""
94-
platforms = self.ARCHITECTURE_PLATFORM_MAPPING.get(architecture.name)
95-
if not platforms:
96-
raise ValueError(
97-
f"unknown architecture {architecture.name}. Supported: {self.ARCHITECTURE_PLATFORM_MAPPING.keys()}",
98-
)
99-
100-
return self._build_platform_args(platforms)
101-
102-
def _build_platform_args(self, platforms: tuple[str, ...]) -> str:
103-
return " ".join([f"--platform {platform}" for platform in platforms])

0 commit comments

Comments
 (0)