repro-lambda 0.2.2__py3-none-any.whl → 0.2.4__py3-none-any.whl

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.
repro_lambda/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """repro-lambda — reproducible AWS Lambda packaging outside Terraform."""
2
2
 
3
- __version__ = "0.2.2"
3
+ __version__ = "0.2.4"
repro_lambda/cli.py CHANGED
@@ -63,6 +63,12 @@ def build(
63
63
  verify: Annotated[bool, typer.Option("--verify")] = False,
64
64
  dry_run: Annotated[bool, typer.Option("--dry-run")] = False,
65
65
  allow_dirty: Annotated[bool, typer.Option("--allow-dirty")] = False,
66
+ arch: Annotated[
67
+ str,
68
+ typer.Option(
69
+ "--arch", help="Only build lambdas with this arch (e.g. arm64, x86_64). Empty = all."
70
+ ),
71
+ ] = "",
66
72
  ) -> None:
67
73
  """Build one lambda (or all) per manifest and upload to S3."""
68
74
  import json
@@ -84,6 +90,12 @@ def build(
84
90
  typer.echo(f"no lambda named {target!r} in {manifest}", err=True)
85
91
  raise typer.Exit(2)
86
92
 
93
+ if arch:
94
+ selected = [s for s in selected if s.arch == arch]
95
+ if not selected:
96
+ typer.echo(f"no lambdas with arch {arch!r} in {manifest}; nothing to build")
97
+ raise typer.Exit(0)
98
+
87
99
  if not dry_run and not bucket:
88
100
  typer.echo(
89
101
  "--bucket or REPRO_LAMBDA_BUCKET env var is required for non-dry-run",
@@ -208,11 +220,24 @@ def init() -> None:
208
220
  raise typer.Exit(0)
209
221
 
210
222
 
223
+ # Stripped from every lambda zip so the container build needs no findutils/xargs
224
+ # (absent from minimal Lambda base images): Python caches and the non-deterministic
225
+ # dist-info metadata files pip writes (RECORD, INSTALLER, direct_url.json, REQUESTED).
226
+ _LAMBDA_ZIP_EXCLUDES = [
227
+ "*__pycache__*",
228
+ "*.pyc",
229
+ "*.dist-info/RECORD",
230
+ "*.dist-info/INSTALLER",
231
+ "*.dist-info/direct_url.json",
232
+ "*.dist-info/REQUESTED",
233
+ ]
234
+
235
+
211
236
  def _zip_impl(src: Path, out: Path) -> None:
212
237
  """Pack a directory into a deterministic zip (used inside container)."""
213
238
  from repro_lambda.zip_packager import pack_directory
214
239
 
215
- pack_directory(src, out)
240
+ pack_directory(src, out, exclude_glob=_LAMBDA_ZIP_EXCLUDES)
216
241
 
217
242
 
218
243
  @app.command(name="zip")
@@ -37,7 +37,7 @@ class DockerRunError(RuntimeError):
37
37
 
38
38
  _PYTHON_INSTALL_SCRIPT = r"""
39
39
  set -euxo pipefail
40
- PKG=/build/pkg
40
+ PKG=/tmp/build/pkg
41
41
  mkdir -p "$PKG"
42
42
  cp -R /src/source/. "$PKG/"
43
43
 
@@ -50,15 +50,9 @@ pip install \
50
50
  --target "$PKG" \
51
51
  --requirement /src/requirements.lock
52
52
 
53
- # v0.1 byte-output cleanup: strip non-deterministic install metadata + caches.
54
- find "$PKG" -type d -name "__pycache__" -prune -exec sh -c 'for d; do rm -rf -- "$d"; done' _ {} +
55
- find "$PKG" -type f -name "*.pyc" -delete
56
- find "$PKG" -type d -name "*.dist-info" -exec sh -c '
57
- for d; do
58
- rm -f -- "$d/RECORD" "$d/INSTALLER" "$d/direct_url.json" "$d/REQUESTED"
59
- done
60
- ' _ {} +
61
-
53
+ # Byte-output cleanup (caches + non-deterministic dist-info metadata) happens in the
54
+ # Python zip step below, so this script needs no findutils/xargs (both absent from the
55
+ # minimal AWS Lambda base images).
62
56
  python3 -m repro_lambda zip --src "$PKG" --out /out/lambda.zip
63
57
  """
64
58
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: repro-lambda
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Build reproducible AWS Lambda packages outside Terraform, optimized for terraform-aws-lambda by serverless.tf.
5
5
  Project-URL: Homepage, https://github.com/antonbabenko/repro-lambda
6
6
  Project-URL: Repository, https://github.com/antonbabenko/repro-lambda
@@ -1,9 +1,9 @@
1
- repro_lambda/__init__.py,sha256=pC11uDhPDkV_QCHO6_AvdBaR3W3DhUDKOQ7zqTclF8s,99
1
+ repro_lambda/__init__.py,sha256=c621a8ME4kNrZHLYn-6mUapxVK4rgHb9gSBHXLoYI5A,99
2
2
  repro_lambda/__main__.py,sha256=kj1fmZneM57F0kbNd_wNDyf2RfF3s2-LGyRArkN89eg,125
3
3
  repro_lambda/build.py,sha256=8zEpHtxWexnVBMwFDzZ2Hw1vZTuRKnVTdwD8iIvS-2w,6226
4
4
  repro_lambda/catalog.py,sha256=Gf15RyQqflgnSDCzQ1J7H0SoSI8ClzdNjWQGnYUmgpo,2146
5
- repro_lambda/cli.py,sha256=q0vgmOUkdqsb0efhqDV8SlPxG3FlF-erFDiyBj7TrN8,6788
6
- repro_lambda/docker_runner.py,sha256=OTQY-RIVIWpYvDJXbZoXgZr36SVpPZrfgxAHhz5L5l4,7607
5
+ repro_lambda/cli.py,sha256=a7H6i8dNbhJ-1fmmGIKjKG4dlICnyBTr6v9fKXnND5Q,7653
6
+ repro_lambda/docker_runner.py,sha256=b7GR-ZFKrjt5e43fG_B7lfsc0-Uyhc-D8Utg1opGVJw,7439
7
7
  repro_lambda/git_guard.py,sha256=qNJ9AiD-OCBrO0EdEvZzAMNDxmoJZBSssxuJaYfEHGw,922
8
8
  repro_lambda/hasher.py,sha256=HX3iqReTX1oY5dHwkZIRLId6dW9eowMl49cT30Fgkf4,2756
9
9
  repro_lambda/manifest.py,sha256=xjFpFXghw134P6X1B--gb3DZTggkvp-qmhi9IJncrtU,4655
@@ -11,8 +11,8 @@ repro_lambda/s3_uploader.py,sha256=NgW9YJnODSx7VXfX5oEOsHAuQbLFmEnORx9xvP8Ivy0,1
11
11
  repro_lambda/source_stager.py,sha256=Sn-vnQ7vFV2NsYxOcpz9WaPJ3AfRBhQJYDxkGsfLr4E,2630
12
12
  repro_lambda/verify.py,sha256=CKtciNRI4B9pnJWHUOaWYdoWnVYvCUrF2LyWTpmIZhg,2912
13
13
  repro_lambda/zip_packager.py,sha256=VoEKXjN6L9X3LCabqBurBsovAZ4U4O23KNbDeIHXzwo,2413
14
- repro_lambda-0.2.2.dist-info/METADATA,sha256=OAETMeiwPtUibP2h7Tkgf9ISyagincqZGwJ7bel_eXM,2756
15
- repro_lambda-0.2.2.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
16
- repro_lambda-0.2.2.dist-info/entry_points.txt,sha256=Ttp1Q08jEiPeuPo-kT2aKYM5STM-IPI4AGdXWXjGGRg,54
17
- repro_lambda-0.2.2.dist-info/licenses/LICENSE,sha256=3Bfccb39fnXN5VkSZh8RemjW03BH4JZkTEQgREhpFNU,9554
18
- repro_lambda-0.2.2.dist-info/RECORD,,
14
+ repro_lambda-0.2.4.dist-info/METADATA,sha256=VI-Ht1JNuN0Ts8VcxkxHNmFu02Fj4wyWuxqGXMIzI8A,2756
15
+ repro_lambda-0.2.4.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
16
+ repro_lambda-0.2.4.dist-info/entry_points.txt,sha256=Ttp1Q08jEiPeuPo-kT2aKYM5STM-IPI4AGdXWXjGGRg,54
17
+ repro_lambda-0.2.4.dist-info/licenses/LICENSE,sha256=3Bfccb39fnXN5VkSZh8RemjW03BH4JZkTEQgREhpFNU,9554
18
+ repro_lambda-0.2.4.dist-info/RECORD,,