aws-lambda-builders 1.69.0__tar.gz → 1.71.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aws_lambda_builders-1.69.0/aws_lambda_builders.egg-info → aws_lambda_builders-1.71.0}/PKG-INFO +4 -2
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/__init__.py +1 -1
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/utils.py +4 -1
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/python_uv/DESIGN.md +149 -27
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/python_uv/actions.py +2 -2
- aws_lambda_builders-1.71.0/aws_lambda_builders/workflows/python_uv/packager.py +734 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/python_uv/utils.py +91 -21
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/python_uv/workflow.py +107 -3
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0/aws_lambda_builders.egg-info}/PKG-INFO +4 -2
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders.egg-info/requires.txt +7 -1
- aws_lambda_builders-1.71.0/requirements/base.txt +1 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/requirements/dev.txt +2 -1
- aws_lambda_builders-1.69.0/aws_lambda_builders/workflows/python_uv/packager.py +0 -424
- aws_lambda_builders-1.69.0/requirements/base.txt +0 -1
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/LICENSE +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/MANIFEST.in +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/NOTICE +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/README.md +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/__main__.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/actions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/architecture.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/binary_path.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/builder.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/exceptions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/path_resolver.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/registry.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/supported_runtimes.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/validator.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflow.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/__init__.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/custom_make/DESIGN.md +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/custom_make/__init__.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/custom_make/actions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/custom_make/exceptions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/custom_make/make.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/custom_make/utils.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/custom_make/validator.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/custom_make/workflow.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/dotnet_clipackage/DESIGN.md +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/dotnet_clipackage/__init__.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/dotnet_clipackage/actions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/dotnet_clipackage/dotnetcli.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/dotnet_clipackage/dotnetcli_resolver.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/dotnet_clipackage/utils.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/dotnet_clipackage/workflow.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/go_modules/DESIGN.md +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/go_modules/__init__.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/go_modules/actions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/go_modules/builder.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/go_modules/utils.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/go_modules/validator.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/go_modules/workflow.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java/__init__.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java/actions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java/utils.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java_gradle/DESIGN.md +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java_gradle/__init__.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java_gradle/actions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java_gradle/gradle.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java_gradle/gradle_resolver.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java_gradle/gradle_validator.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java_gradle/resources/lambda-build-init.gradle +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java_gradle/workflow.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java_maven/DESIGN.md +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java_maven/__init__.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java_maven/actions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java_maven/maven.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java_maven/maven_resolver.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java_maven/maven_validator.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/java_maven/workflow.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/nodejs_npm/DESIGN.md +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/nodejs_npm/__init__.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/nodejs_npm/actions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/nodejs_npm/exceptions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/nodejs_npm/lockfile_closure.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/nodejs_npm/npm.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/nodejs_npm/utils.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/nodejs_npm/workflow.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/nodejs_npm_esbuild/DESIGN.md +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/nodejs_npm_esbuild/__init__.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/nodejs_npm_esbuild/actions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/nodejs_npm_esbuild/esbuild.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/nodejs_npm_esbuild/exceptions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/nodejs_npm_esbuild/workflow.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/python_pip/DESIGN.md +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/python_pip/__init__.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/python_pip/actions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/python_pip/compat.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/python_pip/exceptions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/python_pip/packager.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/python_pip/utils.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/python_pip/validator.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/python_pip/workflow.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/python_uv/__init__.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/python_uv/exceptions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/ruby_bundler/DESIGN.md +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/ruby_bundler/__init__.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/ruby_bundler/actions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/ruby_bundler/bundler.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/ruby_bundler/utils.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/ruby_bundler/workflow.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/rust_cargo/DESIGN.md +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/rust_cargo/__init__.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/rust_cargo/actions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/rust_cargo/cargo_lambda.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/rust_cargo/exceptions.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/rust_cargo/utils.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders/workflows/rust_cargo/workflow.py +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders.egg-info/SOURCES.txt +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders.egg-info/dependency_links.txt +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders.egg-info/entry_points.txt +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/aws_lambda_builders.egg-info/top_level.txt +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/pyproject.toml +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/requirements/python_pip.txt +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/setup.cfg +0 -0
- {aws_lambda_builders-1.69.0 → aws_lambda_builders-1.71.0}/setup.py +0 -0
{aws_lambda_builders-1.69.0/aws_lambda_builders.egg-info → aws_lambda_builders-1.71.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aws_lambda_builders
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.71.0
|
|
4
4
|
Summary: Python library to compile, build & package AWS Lambda functions for several runtimes & frameworks.
|
|
5
5
|
Home-page: https://github.com/awslabs/aws-lambda-builders
|
|
6
6
|
Author: Amazon Web Services
|
|
@@ -27,16 +27,18 @@ Classifier: Topic :: Utilities
|
|
|
27
27
|
Requires-Python: >=3.10
|
|
28
28
|
License-File: LICENSE
|
|
29
29
|
License-File: NOTICE
|
|
30
|
+
Requires-Dist: tomli>=1.1.0; python_version < "3.11"
|
|
30
31
|
Requires-Dist: setuptools
|
|
31
32
|
Requires-Dist: wheel
|
|
32
33
|
Provides-Extra: dev
|
|
33
34
|
Requires-Dist: coverage==7.15.1; extra == "dev"
|
|
34
35
|
Requires-Dist: flake8==3.8.4; extra == "dev"
|
|
35
36
|
Requires-Dist: pytest-cov==6.3.0; extra == "dev"
|
|
37
|
+
Requires-Dist: tomli>=1.1.0; python_version < "3.11" and extra == "dev"
|
|
36
38
|
Requires-Dist: pytest>=9.1.1; extra == "dev"
|
|
37
39
|
Requires-Dist: parameterized==0.9.0; extra == "dev"
|
|
38
40
|
Requires-Dist: pyelftools~=0.33; extra == "dev"
|
|
39
|
-
Requires-Dist: black==26.
|
|
41
|
+
Requires-Dist: black==26.10.1; extra == "dev"
|
|
40
42
|
Requires-Dist: ruff==0.16.5; extra == "dev"
|
|
41
43
|
Dynamic: author
|
|
42
44
|
Dynamic: author-email
|
|
@@ -279,7 +279,10 @@ def extract_tarfile(tarfile_path: Union[str, os.PathLike], unpack_dir: Union[str
|
|
|
279
279
|
if not _is_within_directory(unpack_dir, member_path):
|
|
280
280
|
raise tarfile.ExtractError("Attempted Path Traversal in Tar File")
|
|
281
281
|
|
|
282
|
-
|
|
282
|
+
if hasattr(tarfile, "data_filter"):
|
|
283
|
+
tar.extractall(unpack_dir, filter="data")
|
|
284
|
+
else:
|
|
285
|
+
tar.extractall(unpack_dir)
|
|
283
286
|
|
|
284
287
|
|
|
285
288
|
def _locale_encoding() -> str:
|
|
@@ -15,7 +15,7 @@ UV offers several advantages over pip:
|
|
|
15
15
|
|
|
16
16
|
Similar to the Python PIP workflow, Python packaging for AWS Lambda presents unique challenges:
|
|
17
17
|
|
|
18
|
-
1. **Platform compatibility**: Python packages often contain platform-specific code or compiled extensions that must be compatible with the AWS Lambda runtime environment (Amazon Linux 2)
|
|
18
|
+
1. **Platform compatibility**: Python packages often contain platform-specific code or compiled extensions that must be compatible with the AWS Lambda runtime environment (Amazon Linux 2 for Python 3.8-3.11, Amazon Linux 2023 for Python 3.12+)
|
|
19
19
|
|
|
20
20
|
2. **Architecture compatibility**: Packages must be compatible with the target Lambda architecture (x86_64 or arm64)
|
|
21
21
|
|
|
@@ -64,7 +64,8 @@ def build_dependencies(artifacts_dir_path,
|
|
|
64
64
|
|
|
65
65
|
:type runtime: str
|
|
66
66
|
:param runtime: Python version to build dependencies for. This can
|
|
67
|
-
be python3.8, python3.9, python3.10, python3.11, python3.12,
|
|
67
|
+
be python3.8, python3.9, python3.10, python3.11, python3.12, python3.13,
|
|
68
|
+
python3.14, or python3.15.
|
|
68
69
|
These are currently the only supported values.
|
|
69
70
|
Note: This parameter is passed to the PythonUvDependencyBuilder constructor.
|
|
70
71
|
|
|
@@ -104,37 +105,51 @@ builder.build_dependencies(
|
|
|
104
105
|
|
|
105
106
|
The general algorithm for preparing a python package using UV for use on AWS Lambda follows a streamlined approach that leverages UV's advanced capabilities:
|
|
106
107
|
|
|
107
|
-
#### Step 1:
|
|
108
|
+
#### Step 1: Pick the manifest
|
|
108
109
|
|
|
109
|
-
|
|
110
|
+
An explicit manifest path is used as given. Without one, the workflow picks a manifest in the
|
|
111
|
+
order listed under [Smart Manifest Detection and Dispatch](#smart-manifest-detection-and-dispatch).
|
|
110
112
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
**Smart Lock File Detection:**
|
|
117
|
-
- Look for requirements.txt first
|
|
118
|
-
- When `pyproject.toml` is the manifest, automatically checks for `uv.lock` in the same directory
|
|
119
|
-
- If `uv.lock` exists alongside `pyproject.toml`, uses lock-based build for precise dependencies
|
|
120
|
-
- If no `uv.lock`, uses standard pyproject.toml build with UV's lock and export workflow
|
|
121
|
-
|
|
122
|
-
**Important:** `uv.lock` is NOT a standalone manifest - it's a lock file that enhances `pyproject.toml` builds when present.
|
|
113
|
+
When the manifest is `pyproject.toml`, the workflow resolves the workspace root (the project
|
|
114
|
+
directory for a standalone project; see
|
|
115
|
+
[Workspace Resolution Failure Policy](#workspace-resolution-failure-policy)) and uses a
|
|
116
|
+
`uv.lock` found there. `uv.lock` is never a manifest on its own.
|
|
123
117
|
|
|
124
118
|
#### Step 2: Build dependencies based on manifest type
|
|
125
119
|
|
|
126
120
|
**For pyproject.toml with uv.lock present:**
|
|
127
121
|
- Use `uv export` to convert lock file to requirements.txt format
|
|
122
|
+
- Export with `--locked`, reusing the lock's resolution mode, prerelease mode, fork strategy, and `exclude-newer`
|
|
123
|
+
cutoff so export validates rather than rewrites the existing lock. Stale locks fail the build;
|
|
124
|
+
run `uv lock` explicitly after dependency changes.
|
|
125
|
+
- For relative cutoffs, replay `exclude-newer-span` instead of the lock's placeholder `exclude-newer` date.
|
|
126
|
+
Python 3.10 uses the runtime dependency `tomli` to read lock options; Python 3.11+ uses `tomllib`.
|
|
127
|
+
- Replay each `options.exclude-newer-package` entry with `--exclude-newer-package`, preferring its `span`
|
|
128
|
+
over the placeholder `timestamp` for relative per-package cutoffs.
|
|
128
129
|
- Install using `uv pip install` with platform targeting (--python-platform)
|
|
129
130
|
- Provides reproducible builds with locked dependency versions AND cross-platform support
|
|
130
131
|
|
|
131
132
|
**For pyproject.toml without uv.lock:**
|
|
132
|
-
-
|
|
133
|
+
- Run `uv lock` from the project directory. uv writes `uv.lock` there, or at the workspace root
|
|
134
|
+
for a workspace member, and the file stays in the source tree after the build
|
|
133
135
|
- Use `uv export` to convert lock file to requirements.txt format
|
|
134
136
|
- Install dependencies using `uv pip install` with platform targeting
|
|
135
137
|
|
|
138
|
+
**Stale locks:** both pyproject.toml paths run `uv export --locked`, so a `uv.lock` that no longer
|
|
139
|
+
matches `pyproject.toml` fails the build instead of being rewritten. A project without
|
|
140
|
+
`requires-python` that was locked on one Python version can be stale on another runtime; set
|
|
141
|
+
`requires-python` or run `uv lock` again.
|
|
142
|
+
|
|
143
|
+
**Hashes:** the export keeps the lock's hashes, so a project that sets `require-hashes` in
|
|
144
|
+
`[tool.uv.pip]` builds.
|
|
145
|
+
|
|
136
146
|
**For requirements.txt files:**
|
|
137
147
|
- Use `uv pip install` directly with Lambda-compatible settings
|
|
148
|
+
- uv runs from the manifest's directory, so local paths in the file (such as `./libs/foo` or
|
|
149
|
+
`-e ../shared`) resolve from there
|
|
150
|
+
|
|
151
|
+
**Local paths in lock builds:** exported local paths are relative to the workspace root, so
|
|
152
|
+
`uv pip install` runs from the workspace root (the project directory for a standalone project).
|
|
138
153
|
|
|
139
154
|
**Why export + pip install instead of uv sync?**
|
|
140
155
|
`uv sync` doesn't support cross-platform builds (no --python-platform flag). Since Lambda
|
|
@@ -145,7 +160,9 @@ the `--python-platform` flag for cross-platform wheel selection.
|
|
|
145
160
|
#### Step 3: Configure Lambda-compatible installation
|
|
146
161
|
|
|
147
162
|
UV is configured with Lambda-specific settings:
|
|
148
|
-
- Target platform:
|
|
163
|
+
- Target platform: explicit manylinux targets, independent of the build host's glibc.
|
|
164
|
+
Python 3.8-3.11 use `manylinux_2_17` (the AL2-compatible download target used by the pip workflow);
|
|
165
|
+
Python 3.12+ use `manylinux_2_34` for Amazon Linux 2023.
|
|
149
166
|
- Target architecture: `x86_64` or `aarch64`
|
|
150
167
|
- Python version matching Lambda runtime
|
|
151
168
|
- Prefer wheels over source distributions for faster builds
|
|
@@ -205,12 +222,70 @@ config = {
|
|
|
205
222
|
"no_cache": False, # Disable caching
|
|
206
223
|
"prerelease": "disallow", # Handle pre-release versions
|
|
207
224
|
"resolution": "highest", # Resolution strategy
|
|
208
|
-
"compile_bytecode":
|
|
225
|
+
"compile_bytecode": False, # Opt in to unchecked-hash .pyc compiled with the target Python
|
|
209
226
|
"exclude_newer": None, # Exclude packages newer than date
|
|
210
227
|
"generate_hashes": False, # Generate package hashes
|
|
211
228
|
}
|
|
212
229
|
```
|
|
213
230
|
|
|
231
|
+
### Build options
|
|
232
|
+
|
|
233
|
+
`PythonUvWorkflow` reads these keys from the workflow `options` and passes them to `uv export`.
|
|
234
|
+
SAM CLI maps them from `Metadata.BuildProperties`.
|
|
235
|
+
|
|
236
|
+
| Option | SAM CLI property | Type | `uv export` effect |
|
|
237
|
+
|---|---|---|---|
|
|
238
|
+
| `uv_groups` | `UvGroups` | list of str | `--group <name>` per entry |
|
|
239
|
+
| `uv_extras` | `UvExtras` | list of str | `--extra <name>` per entry |
|
|
240
|
+
| `uv_all_extras` | `UvAllExtras` | bool | `--all-extras` |
|
|
241
|
+
| `uv_prune` | `UvPrune` | list of str | `--prune <name>` per entry: drops the package and any dependency only it needs |
|
|
242
|
+
| `uv_compile_bytecode` | `UvCompileBytecode` | bool | none; after install, runs `compileall --invalidation-mode unchecked-hash` with the target Python (also for `requirements.txt` builds) |
|
|
243
|
+
|
|
244
|
+
Default groups stay excluded (`--no-default-groups`); `uv_groups` adds groups on top of that.
|
|
245
|
+
`uv_prune` is meant for packages the Lambda runtime already ships, such as `boto3`. The function then
|
|
246
|
+
uses the runtime's version, which AWS picks, not the version in `uv.lock`.
|
|
247
|
+
The build fails with a clear message, instead of ignoring the option, when:
|
|
248
|
+
- a value has the wrong type, or an unknown `uv_*` key is given;
|
|
249
|
+
- `uv_extras` and `uv_all_extras` are combined;
|
|
250
|
+
- an option other than `uv_compile_bytecode` is set on a `requirements.txt` build (they apply only to
|
|
251
|
+
pyproject.toml / uv.lock projects);
|
|
252
|
+
- a `uv_prune` name is not a package in `uv.lock`, which `uv export --prune` would otherwise ignore.
|
|
253
|
+
|
|
254
|
+
### Bytecode
|
|
255
|
+
|
|
256
|
+
uv writes timestamp-based `.pyc` files, which the Lambda runtime rejects once SAM normalizes file
|
|
257
|
+
timestamps in the deployment package. So the workflow always passes `--no-compile-bytecode` to
|
|
258
|
+
`uv pip install`, removes `UV_COMPILE_BYTECODE` from that command's environment (uv refuses the flag and
|
|
259
|
+
the variable together), and, when bytecode is enabled, runs the target Python
|
|
260
|
+
(`uv python find --no-project --no-python-downloads <version>`) as
|
|
261
|
+
`python -m compileall -f -q --invalidation-mode unchecked-hash` over the install directory.
|
|
262
|
+
|
|
263
|
+
Bytecode is enabled by `uv_compile_bytecode: true`. When that option isn't given, a truthy
|
|
264
|
+
`UV_COMPILE_BYTECODE` in the build environment enables it too, and the build logs that at INFO. Values are
|
|
265
|
+
read the way uv reads them, case-insensitively: `1`, `true`, `t`, `yes`, `y`, `on` enable it; `0`, `false`,
|
|
266
|
+
`f`, `no`, `n`, `off` leave it off; any other value logs a warning and leaves it off. An explicit
|
|
267
|
+
`uv_compile_bytecode: false` always wins over the variable. If the target Python isn't installed, or the
|
|
268
|
+
runtime gives no version, the build logs a warning and ships no bytecode instead of failing.
|
|
269
|
+
|
|
270
|
+
### Settings from pyproject.toml
|
|
271
|
+
|
|
272
|
+
The workflow runs `uv export` and `uv pip install` from the project, so uv reads its own settings there.
|
|
273
|
+
Build-control settings in `[tool.uv]` (`no-build`, `no-build-package`, `no-binary`, `no-binary-package`) apply
|
|
274
|
+
to both steps; `[tool.uv.pip]` settings (`no-build`, `no-binary`, `only-binary`) apply to the install. `UV_*`
|
|
275
|
+
environment variables apply to every uv call, except `UV_COMPILE_BYTECODE` (see Bytecode). The workflow's own flags always win: the target platform and
|
|
276
|
+
Python version come from the function's architecture and runtime, default groups are excluded, and nothing
|
|
277
|
+
is installed editable. In a uv workspace only the workspace root's `pyproject.toml` settings are used; a
|
|
278
|
+
member's `[tool.uv]` and `[tool.uv.pip]` tables are ignored. An unknown key in either table makes uv ignore
|
|
279
|
+
every setting in that file. The build log shows uv's warning about it (the workflow logs every `warning:`
|
|
280
|
+
that uv prints, once per build), so check the key names against uv's settings reference.
|
|
281
|
+
|
|
282
|
+
### uv warnings
|
|
283
|
+
|
|
284
|
+
Every `warning:` block uv prints is logged at WARNING, once per build. Some are harmless, such as
|
|
285
|
+
"Failed to hardlink files; falling back to full copy" when the cache and the target are on
|
|
286
|
+
different file systems. The one to act on is an unknown key in `[tool.uv]` (or `[tool.uv.pip]`):
|
|
287
|
+
uv then ignores every setting in that file.
|
|
288
|
+
|
|
214
289
|
### Caching
|
|
215
290
|
|
|
216
291
|
The workflow does not pass `--cache-dir` unless a caller supplies one, so UV uses its own
|
|
@@ -224,6 +299,11 @@ and across successive builds. Pointing UV at the build's scratch directory inste
|
|
|
224
299
|
discard the cache every time, because that directory is deleted when the build finishes — every
|
|
225
300
|
function would then re-download its entire dependency set on every build.
|
|
226
301
|
|
|
302
|
+
The one exception is a default cache location that can't be created, such as `/.cache/uv` for a
|
|
303
|
+
container build run as a host uid with no home directory (`sam build --use-container
|
|
304
|
+
--mount-with WRITE`). Then the build uses `uv-cache` under the scratch directory and logs a
|
|
305
|
+
warning. Nothing is lost there, because such a container starts with an empty cache anyway.
|
|
306
|
+
|
|
227
307
|
### Compatibility with Existing Workflows
|
|
228
308
|
|
|
229
309
|
The UV workflow is designed to be a drop-in replacement for the pip workflow:
|
|
@@ -244,7 +324,7 @@ The UV workflow consists of several key components that mirror the PIP workflow
|
|
|
244
324
|
2. **PythonUvBuildAction**: Action class that handles dependency resolution
|
|
245
325
|
3. **UvRunner**: Wrapper around UV command execution
|
|
246
326
|
4. **SubprocessUv**: Low-level UV subprocess interface
|
|
247
|
-
|
|
327
|
+
5. **PythonUvDependencyBuilder**: High-level dependency builder orchestrator
|
|
248
328
|
|
|
249
329
|
#### File Structure
|
|
250
330
|
```
|
|
@@ -271,13 +351,17 @@ CAPABILITY = Capability(
|
|
|
271
351
|
|
|
272
352
|
The workflow uses intelligent manifest detection:
|
|
273
353
|
|
|
274
|
-
**
|
|
275
|
-
1. `
|
|
276
|
-
2. `requirements
|
|
277
|
-
3. `pyproject.toml`
|
|
354
|
+
**Auto-detection (when no manifest path is given), in order of preference:**
|
|
355
|
+
1. `pyproject.toml`, when it is the uv project: a `uv.lock` sits beside it, or its `[project]` table declares a non-empty `dependencies` list
|
|
356
|
+
2. `requirements.txt`, then `requirements-prod.txt`
|
|
357
|
+
3. `pyproject.toml` otherwise (metadata or tool settings only, empty `dependencies`, or `dynamic` dependencies)
|
|
358
|
+
|
|
359
|
+
`requirements-dev.txt` and `requirements-test.txt` are never auto-detected: development and test dependencies do not belong in a Lambda package. They can still be passed as an explicit manifest path.
|
|
360
|
+
|
|
361
|
+
On Python 3.10 without `tomli`, declared dependencies cannot be read, so only a `uv.lock` makes `pyproject.toml` win over a requirements file.
|
|
278
362
|
|
|
279
363
|
**Smart Lock File Enhancement:**
|
|
280
|
-
- When `pyproject.toml` is used, automatically detects `uv.lock`
|
|
364
|
+
- When `pyproject.toml` is used, automatically detects `uv.lock` at the resolved workspace or project root
|
|
281
365
|
- If `uv.lock` exists, uses lock-based build for reproducible dependencies
|
|
282
366
|
- If no `uv.lock`, uses standard pyproject.toml workflow with UV's lock and export
|
|
283
367
|
|
|
@@ -291,12 +375,16 @@ The workflow follows Python ecosystem standards for requirements files:
|
|
|
291
375
|
- `requirements-prod.txt` - Production dependencies
|
|
292
376
|
- `requirements-staging.txt` - Staging dependencies
|
|
293
377
|
|
|
378
|
+
Only `requirements.txt` and `requirements-prod.txt` are auto-detected. The others are used only
|
|
379
|
+
when passed as the manifest path.
|
|
380
|
+
|
|
294
381
|
Note: `requirements.in` (pip-tools format) is not supported to keep the implementation simple and focused.
|
|
295
382
|
|
|
296
383
|
#### UV Binary Requirements
|
|
297
384
|
- UV must be available on the system PATH
|
|
298
385
|
- Minimum UV version: 0.1.0 (to be determined based on feature requirements)
|
|
299
|
-
-
|
|
386
|
+
- Workspace discovery needs UV 0.9.9 or newer; older versions build from the project directory
|
|
387
|
+
- A missing UV raises `MissingUvError`; the workflow does not install UV
|
|
300
388
|
|
|
301
389
|
#### Error Handling Strategy
|
|
302
390
|
- **MissingUvError**: UV binary not found on PATH (includes path information)
|
|
@@ -304,6 +392,39 @@ Note: `requirements.in` (pip-tools format) is not supported to keep the implemen
|
|
|
304
392
|
- **UvBuildError**: Package build failures
|
|
305
393
|
- **LockFileError**: Lock file parsing or validation errors
|
|
306
394
|
|
|
395
|
+
#### Workspace Resolution Failure Policy
|
|
396
|
+
|
|
397
|
+
Workspace discovery runs before the lock-file lookup for every `pyproject.toml` build.
|
|
398
|
+
The compatibility fallback to the project directory is deliberately limited to two cases:
|
|
399
|
+
|
|
400
|
+
- A plain `X.Y.Z` UV version is numerically below `0.9.9`; the workspace command is not invoked.
|
|
401
|
+
- The workspace command exits unsuccessfully and stderr contains `unrecognized subcommand 'workspace'`.
|
|
402
|
+
|
|
403
|
+
Both cases log at DEBUG. They additionally emit a WARNING only if a `pyproject.toml`
|
|
404
|
+
in the project directory or an ancestor contains a `tool.uv.workspace` table. This is
|
|
405
|
+
only a diagnostic hint: `members` and `exclude` are not evaluated, so the warning does
|
|
406
|
+
not assert membership or change the chosen root or build path. Unreadable or invalid
|
|
407
|
+
TOML is logged at DEBUG and skipped. The helper lazily imports `tomllib`, or optional
|
|
408
|
+
`tomli` on Python 3.10. If neither is available, it logs at DEBUG and skips configuration
|
|
409
|
+
inspection; no TOML parser is required to build dependencies.
|
|
410
|
+
This preserves the previous behavior for standalone projects
|
|
411
|
+
using unsupported UV versions; it does not provide workspace support for those versions.
|
|
412
|
+
Unknown or prerelease version strings are tested by invoking the workspace command rather
|
|
413
|
+
than assuming support or lack of support.
|
|
414
|
+
|
|
415
|
+
All other command failures raise `UvBuildError` with the diagnostic, and a successful exit
|
|
416
|
+
with empty or whitespace-only output also raises because it supplies no root directory.
|
|
417
|
+
These outcomes do not establish that the project is outside a workspace. Falling back could
|
|
418
|
+
miss an existing workspace-root lock, trigger lock generation, or resolve local dependencies
|
|
419
|
+
from the wrong directory.
|
|
420
|
+
|
|
421
|
+
This intentionally favors stopping on uncertain workspace discovery over continuing a
|
|
422
|
+
potentially incorrect build. Consequently, a standalone project that previously built may
|
|
423
|
+
now stop if workspace discovery fails for an unknown reason. That compatibility limitation
|
|
424
|
+
is accepted rather than treating permission, configuration, or process-start failures as
|
|
425
|
+
evidence that the workspace command is unsupported. The original diagnostic is surfaced
|
|
426
|
+
instead of recommending an upgrade for an unknown cause.
|
|
427
|
+
|
|
307
428
|
#### Platform Compatibility Matrix
|
|
308
429
|
| Python Version | x86_64 | arm64 | Status |
|
|
309
430
|
|---------------|--------|-------|---------|
|
|
@@ -313,7 +434,8 @@ Note: `requirements.in` (pip-tools format) is not supported to keep the implemen
|
|
|
313
434
|
| python3.11 | ✓ | ✓ | Supported |
|
|
314
435
|
| python3.12 | ✓ | ✓ | Supported |
|
|
315
436
|
| python3.13 | ✓ | ✓ | Supported |
|
|
316
|
-
| python3.
|
|
437
|
+
| python3.14 | ✓ | ✓ | Supported |
|
|
438
|
+
| python3.15 | ✓ | ✓ | Supported |
|
|
317
439
|
|
|
318
440
|
#### Integration with Lambda Builders
|
|
319
441
|
- Registers with the workflow registry automatically
|
|
@@ -8,7 +8,7 @@ from typing import Optional
|
|
|
8
8
|
from aws_lambda_builders.actions import ActionFailedError, BaseAction, Purpose
|
|
9
9
|
from aws_lambda_builders.architecture import X86_64
|
|
10
10
|
|
|
11
|
-
from .exceptions import MissingUvError, UvBuildError, UvInstallationError
|
|
11
|
+
from .exceptions import LockFileError, MissingUvError, UvBuildError, UvInstallationError
|
|
12
12
|
from .packager import PythonUvDependencyBuilder, SubprocessUv, UvRunner
|
|
13
13
|
from .utils import OSUtils, UvConfig
|
|
14
14
|
|
|
@@ -72,5 +72,5 @@ class PythonUvBuildAction(BaseAction):
|
|
|
72
72
|
architecture=self.architecture,
|
|
73
73
|
config=self.config,
|
|
74
74
|
)
|
|
75
|
-
except (MissingUvError, UvInstallationError, UvBuildError) as ex:
|
|
75
|
+
except (LockFileError, MissingUvError, UvInstallationError, UvBuildError) as ex:
|
|
76
76
|
raise ActionFailedError(str(ex))
|