repro-lambda 0.1.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.
Files changed (44) hide show
  1. repro_lambda-0.1.0/.github/workflows/build.yml +98 -0
  2. repro_lambda-0.1.0/.github/workflows/ci.yml +22 -0
  3. repro_lambda-0.1.0/.github/workflows/publish.yml +33 -0
  4. repro_lambda-0.1.0/.gitignore +18 -0
  5. repro_lambda-0.1.0/.pre-commit-config.yaml +15 -0
  6. repro_lambda-0.1.0/CHANGELOG.md +26 -0
  7. repro_lambda-0.1.0/LICENSE +177 -0
  8. repro_lambda-0.1.0/PKG-INFO +68 -0
  9. repro_lambda-0.1.0/README.md +36 -0
  10. repro_lambda-0.1.0/pyproject.toml +62 -0
  11. repro_lambda-0.1.0/src/repro_lambda/__init__.py +3 -0
  12. repro_lambda-0.1.0/src/repro_lambda/__main__.py +6 -0
  13. repro_lambda-0.1.0/src/repro_lambda/build.py +141 -0
  14. repro_lambda-0.1.0/src/repro_lambda/catalog.py +71 -0
  15. repro_lambda-0.1.0/src/repro_lambda/cli.py +219 -0
  16. repro_lambda-0.1.0/src/repro_lambda/docker_runner.py +122 -0
  17. repro_lambda-0.1.0/src/repro_lambda/git_guard.py +39 -0
  18. repro_lambda-0.1.0/src/repro_lambda/hasher.py +56 -0
  19. repro_lambda-0.1.0/src/repro_lambda/manifest.py +110 -0
  20. repro_lambda-0.1.0/src/repro_lambda/s3_uploader.py +53 -0
  21. repro_lambda-0.1.0/src/repro_lambda/source_stager.py +68 -0
  22. repro_lambda-0.1.0/src/repro_lambda/verify.py +61 -0
  23. repro_lambda-0.1.0/src/repro_lambda/zip_packager.py +70 -0
  24. repro_lambda-0.1.0/tests/__init__.py +1 -0
  25. repro_lambda-0.1.0/tests/conftest.py +10 -0
  26. repro_lambda-0.1.0/tests/fixtures/sample_python_lambda/handler/app.py +2 -0
  27. repro_lambda-0.1.0/tests/fixtures/sample_python_lambda/handler/requirements.arm64.lock +1 -0
  28. repro_lambda-0.1.0/tests/fixtures/sample_python_lambda/handler/requirements.in +0 -0
  29. repro_lambda-0.1.0/tests/fixtures/sample_python_lambda/lambdas.toml +16 -0
  30. repro_lambda-0.1.0/tests/test_build_integration.py +147 -0
  31. repro_lambda-0.1.0/tests/test_catalog.py +96 -0
  32. repro_lambda-0.1.0/tests/test_cli_build.py +111 -0
  33. repro_lambda-0.1.0/tests/test_cli_lock.py +65 -0
  34. repro_lambda-0.1.0/tests/test_cli_smoke.py +32 -0
  35. repro_lambda-0.1.0/tests/test_docker_runner.py +64 -0
  36. repro_lambda-0.1.0/tests/test_e2e_python_lambda.py +64 -0
  37. repro_lambda-0.1.0/tests/test_git_guard.py +39 -0
  38. repro_lambda-0.1.0/tests/test_hasher.py +92 -0
  39. repro_lambda-0.1.0/tests/test_manifest.py +81 -0
  40. repro_lambda-0.1.0/tests/test_s3_uploader.py +55 -0
  41. repro_lambda-0.1.0/tests/test_source_stager.py +95 -0
  42. repro_lambda-0.1.0/tests/test_verify.py +82 -0
  43. repro_lambda-0.1.0/tests/test_zip_packager.py +79 -0
  44. repro_lambda-0.1.0/uv.lock +845 -0
@@ -0,0 +1,98 @@
1
+ name: build-lambdas (reusable)
2
+
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ manifest_path:
7
+ type: string
8
+ default: lambdas.toml
9
+ description: Path to lambdas.toml in the caller repo.
10
+ repro_lambda_version:
11
+ type: string
12
+ default: "0.1.0"
13
+ description: Pinned repro-lambda PyPI version.
14
+ secrets:
15
+ aws-dev-role-arn:
16
+ required: true
17
+ aws-prod-role-arn:
18
+ required: false
19
+
20
+ jobs:
21
+ detect-arches:
22
+ runs-on: ubuntu-24.04
23
+ outputs:
24
+ arches: ${{ steps.parse.outputs.arches }}
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+ - uses: astral-sh/setup-uv@v3
28
+ - id: parse
29
+ shell: bash
30
+ run: |
31
+ uv run python - <<'PY'
32
+ import json, os, sys
33
+ try:
34
+ import tomllib
35
+ except ImportError:
36
+ import tomli as tomllib
37
+ with open("${{ inputs.manifest_path }}", "rb") as f:
38
+ data = tomllib.load(f)
39
+ arches = sorted({l["arch"] for l in data.get("lambda", [])})
40
+ with open(os.environ["GITHUB_OUTPUT"], "a") as f:
41
+ f.write(f"arches={json.dumps(arches)}\n")
42
+ PY
43
+
44
+ build:
45
+ needs: detect-arches
46
+ strategy:
47
+ fail-fast: false
48
+ matrix:
49
+ arch: ${{ fromJSON(needs.detect-arches.outputs.arches) }}
50
+ runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
51
+ permissions:
52
+ id-token: write
53
+ contents: write
54
+ steps:
55
+ - uses: actions/checkout@v4
56
+ - uses: astral-sh/setup-uv@v3
57
+
58
+ - name: Install repro-lambda
59
+ run: uv pip install --system "repro-lambda==${{ inputs.repro_lambda_version }}"
60
+
61
+ - name: Configure AWS credentials (dev)
62
+ uses: aws-actions/configure-aws-credentials@v4
63
+ with:
64
+ role-to-assume: ${{ secrets.aws-dev-role-arn }}
65
+ aws-region: eu-west-1
66
+
67
+ - name: Build (dev bucket)
68
+ env:
69
+ REPRO_LAMBDA_BUCKET: dev-ctf-lambda-artifacts
70
+ run: repro-lambda build --manifest "${{ inputs.manifest_path }}"
71
+
72
+ - name: Verify reproducible (PR only)
73
+ if: github.event_name == 'pull_request'
74
+ run: repro-lambda build --manifest "${{ inputs.manifest_path }}" --verify --dry-run
75
+
76
+ - name: Configure AWS credentials (prod)
77
+ if: github.ref == 'refs/heads/master' && secrets.aws-prod-role-arn != ''
78
+ uses: aws-actions/configure-aws-credentials@v4
79
+ with:
80
+ role-to-assume: ${{ secrets.aws-prod-role-arn }}
81
+ aws-region: eu-west-1
82
+
83
+ - name: Build (prod bucket)
84
+ if: github.ref == 'refs/heads/master' && secrets.aws-prod-role-arn != ''
85
+ env:
86
+ REPRO_LAMBDA_BUCKET: prod-ctf-lambda-artifacts
87
+ run: repro-lambda build --manifest "${{ inputs.manifest_path }}"
88
+
89
+ - name: Commit catalog drift (master only, dev bot)
90
+ if: github.ref == 'refs/heads/master'
91
+ run: |
92
+ if [[ -n "$(git status --porcelain builds/catalog.json)" ]]; then
93
+ git config user.email "github-actions[bot]@users.noreply.github.com"
94
+ git config user.name "github-actions[bot]"
95
+ git add builds/catalog.json
96
+ git commit -m "chore(catalog): auto-update after build [skip ci]"
97
+ git push
98
+ fi
@@ -0,0 +1,22 @@
1
+ name: ci
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+
8
+ jobs:
9
+ lint-and-test:
10
+ runs-on: ubuntu-24.04
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: astral-sh/setup-uv@v3
14
+ with:
15
+ enable-cache: true
16
+ - run: uv sync --all-extras
17
+ - name: ruff format
18
+ run: uv run ruff format --check src tests
19
+ - name: ruff check
20
+ run: uv run ruff check src tests
21
+ - name: pytest (no docker)
22
+ run: uv run pytest -v -m "not docker"
@@ -0,0 +1,33 @@
1
+ name: publish
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ jobs:
8
+ build-and-publish:
9
+ runs-on: ubuntu-24.04
10
+ permissions:
11
+ id-token: write
12
+ contents: read
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: astral-sh/setup-uv@v3
16
+ - run: uv sync --all-extras
17
+
18
+ - name: Verify tag matches package version
19
+ run: |
20
+ TAG="${GITHUB_REF#refs/tags/v}"
21
+ PKG=$(uv run python -c "import repro_lambda; print(repro_lambda.__version__)")
22
+ if [[ "$TAG" != "$PKG" ]]; then
23
+ echo "tag $TAG != package version $PKG" >&2
24
+ exit 1
25
+ fi
26
+
27
+ - name: Build sdist + wheel
28
+ run: uv build
29
+
30
+ - name: Publish to PyPI
31
+ uses: pypa/gh-action-pypi-publish@release/v1
32
+ with:
33
+ packages-dir: dist/
@@ -0,0 +1,18 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ *.egg-info/
7
+ dist/
8
+ build/
9
+ .coverage
10
+ *.zip
11
+
12
+ # Local-only tooling state (never published to public remote)
13
+ .beads/
14
+ .dolt/
15
+ .beads-credential-key
16
+ .claude/
17
+ AGENTS.md
18
+ CLAUDE.md
@@ -0,0 +1,15 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.5.7
4
+ hooks:
5
+ - id: ruff-format
6
+ - id: ruff
7
+ args: [--fix]
8
+ - repo: local
9
+ hooks:
10
+ - id: pytest
11
+ name: pytest
12
+ entry: uv run pytest -m "not docker"
13
+ language: system
14
+ pass_filenames: false
15
+ stages: [pre-push]
@@ -0,0 +1,26 @@
1
+ # Changelog
2
+
3
+ ## v0.1.0 — 2026-05-27
4
+
5
+ Initial public release.
6
+
7
+ ### Features
8
+
9
+ - Python 3.11/3.12/3.13 Lambda packaging with `pip install --require-hashes`
10
+ - Byte-reproducible zips via deterministic `zipfile.ZipFile` writes
11
+ (sorted entries, fixed mtime 1980-01-01, 0o755 dirs / 0o644 files / 0o755 executables)
12
+ - Content-hash sha256 cache key (source tree + lockfile + spec + base image digest + builder version)
13
+ - Idempotent S3 upload via `If-None-Match=*`, designed for bucket-policy-enforced immutability
14
+ - `--verify` two-pass byte-reproducibility check
15
+ - `--dry-run` for hash + catalog inspection
16
+ - `--allow-dirty` for local iteration
17
+ - `builds/catalog.json` with bounded 10-entry history per lambda
18
+ - Per-arch lockfile generation via `uv pip compile`
19
+ - Reusable GitHub Actions workflow at `.github/workflows/build.yml`
20
+ - Native arm64 + x86_64 build matrix (no QEMU)
21
+
22
+ ### Not yet supported (planned for v0.2)
23
+
24
+ - Node.js / npm packaging
25
+ - Lambda@Edge-specific constraints (us-east-1 routing, no env vars)
26
+ - Rust runtime
@@ -0,0 +1,177 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined in Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
25
+ permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or Object
37
+ form, made available under the License, as indicated by a copyright
38
+ notice that is included in or attached to the work (an example is
39
+ provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original Work and any Derivative Works thereof, that is intentionally
51
+ submitted to, or received by, Licensor for inclusion in the Work
52
+ by the copyright owner or by an individual or Legal Entity authorized
53
+ to submit on behalf of the copyright owner. For the purposes of this
54
+ definition, "submitted" means any form of electronic, verbal, or
55
+ written communication sent to the Licensor or its representatives,
56
+ including but not limited to communication on electronic mailing lists,
57
+ source code control systems, and issue tracking systems that are
58
+ managed by, or on behalf of, the Licensor for the purpose of
59
+ discussing and improving the Work, but excluding communication
60
+ that is conspicuously marked or otherwise designated in writing by
61
+ the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean any individual or Legal Entity on behalf
64
+ of whom a Contribution has been received by Licensor and subsequently
65
+ incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file, then any
108
+ Derivative Works that You distribute must include a readable
109
+ copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE from the Work, provided that
121
+ such additional attribution notices cannot be construed as
122
+ modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions of this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contribution.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.4
2
+ Name: repro-lambda
3
+ Version: 0.1.0
4
+ Summary: Build reproducible AWS Lambda packages outside Terraform, optimized for terraform-aws-lambda by serverless.tf.
5
+ Project-URL: Homepage, https://github.com/antonbabenko/repro-lambda
6
+ Project-URL: Repository, https://github.com/antonbabenko/repro-lambda
7
+ Project-URL: Issues, https://github.com/antonbabenko/repro-lambda/issues
8
+ Author-email: Anton Babenko <anton@antonbabenko.com>
9
+ License: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: aws,lambda,reproducible-builds,serverless,terraform
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Operating System :: MacOS :: MacOS X
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Build Tools
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: boto3>=1.34
22
+ Requires-Dist: repro-zipfile>=0.3.1
23
+ Requires-Dist: typer>=0.12
24
+ Provides-Extra: dev
25
+ Requires-Dist: moto[s3]>=5; extra == 'dev'
26
+ Requires-Dist: pre-commit>=3.7; extra == 'dev'
27
+ Requires-Dist: pytest-mock>=3.12; extra == 'dev'
28
+ Requires-Dist: pytest>=8; extra == 'dev'
29
+ Requires-Dist: pyyaml>=6; extra == 'dev'
30
+ Requires-Dist: ruff>=0.5; extra == 'dev'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # repro-lambda
34
+
35
+ Build reproducible AWS Lambda packages outside Terraform, optimized for
36
+ [terraform-aws-lambda by serverless.tf](https://registry.terraform.io/modules/terraform-aws-modules/lambda/aws/latest).
37
+
38
+ Produces byte-identical zip files across local dev (macOS) and CI (Linux),
39
+ uploads to S3 by content-hash key, and lets Terraform read `s3_existing_package`
40
+ instead of building during `terraform plan`/`apply`.
41
+
42
+ ## Install
43
+
44
+ pip install repro-lambda
45
+
46
+ ## Usage
47
+
48
+ repro-lambda init # scaffold lambdas.toml and CI caller workflow
49
+ repro-lambda lock # regenerate per-arch lockfiles
50
+ repro-lambda build # build all lambdas in lambdas.toml, upload to S3
51
+ repro-lambda build --verify # two-pass byte-reproducibility check
52
+
53
+ See `docs/` for full design.
54
+
55
+ ## Release
56
+
57
+ Releases are tag-driven. To cut v0.1.1:
58
+
59
+ git tag v0.1.1
60
+ git push origin v0.1.1
61
+
62
+ The `publish.yml` workflow uses PyPI Trusted Publishing (OIDC) — no PyPI token
63
+ needed in repo secrets. Configure once via PyPI's "Publishing" panel:
64
+
65
+ - Owner: `antonbabenko`
66
+ - Repository: `repro-lambda`
67
+ - Workflow: `publish.yml`
68
+ - Environment: (leave blank)
@@ -0,0 +1,36 @@
1
+ # repro-lambda
2
+
3
+ Build reproducible AWS Lambda packages outside Terraform, optimized for
4
+ [terraform-aws-lambda by serverless.tf](https://registry.terraform.io/modules/terraform-aws-modules/lambda/aws/latest).
5
+
6
+ Produces byte-identical zip files across local dev (macOS) and CI (Linux),
7
+ uploads to S3 by content-hash key, and lets Terraform read `s3_existing_package`
8
+ instead of building during `terraform plan`/`apply`.
9
+
10
+ ## Install
11
+
12
+ pip install repro-lambda
13
+
14
+ ## Usage
15
+
16
+ repro-lambda init # scaffold lambdas.toml and CI caller workflow
17
+ repro-lambda lock # regenerate per-arch lockfiles
18
+ repro-lambda build # build all lambdas in lambdas.toml, upload to S3
19
+ repro-lambda build --verify # two-pass byte-reproducibility check
20
+
21
+ See `docs/` for full design.
22
+
23
+ ## Release
24
+
25
+ Releases are tag-driven. To cut v0.1.1:
26
+
27
+ git tag v0.1.1
28
+ git push origin v0.1.1
29
+
30
+ The `publish.yml` workflow uses PyPI Trusted Publishing (OIDC) — no PyPI token
31
+ needed in repo secrets. Configure once via PyPI's "Publishing" panel:
32
+
33
+ - Owner: `antonbabenko`
34
+ - Repository: `repro-lambda`
35
+ - Workflow: `publish.yml`
36
+ - Environment: (leave blank)
@@ -0,0 +1,62 @@
1
+ [project]
2
+ name = "repro-lambda"
3
+ version = "0.1.0"
4
+ description = "Build reproducible AWS Lambda packages outside Terraform, optimized for terraform-aws-lambda by serverless.tf."
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ license = { text = "Apache-2.0" }
8
+ authors = [{ name = "Anton Babenko", email = "anton@antonbabenko.com" }]
9
+ keywords = ["aws", "lambda", "terraform", "reproducible-builds", "serverless"]
10
+ classifiers = [
11
+ "Programming Language :: Python :: 3",
12
+ "Programming Language :: Python :: 3.11",
13
+ "Programming Language :: Python :: 3.12",
14
+ "Programming Language :: Python :: 3.13",
15
+ "License :: OSI Approved :: Apache Software License",
16
+ "Operating System :: POSIX :: Linux",
17
+ "Operating System :: MacOS :: MacOS X",
18
+ "Topic :: Software Development :: Build Tools",
19
+ ]
20
+ dependencies = [
21
+ "typer>=0.12",
22
+ "repro-zipfile>=0.3.1",
23
+ "boto3>=1.34",
24
+
25
+ ]
26
+
27
+ [project.optional-dependencies]
28
+ dev = [
29
+ "pytest>=8",
30
+ "pytest-mock>=3.12",
31
+ "moto[s3]>=5",
32
+ "ruff>=0.5",
33
+ "pre-commit>=3.7",
34
+ "pyyaml>=6",
35
+ ]
36
+
37
+ [project.scripts]
38
+ repro-lambda = "repro_lambda.cli:app"
39
+
40
+ [project.urls]
41
+ Homepage = "https://github.com/antonbabenko/repro-lambda"
42
+ Repository = "https://github.com/antonbabenko/repro-lambda"
43
+ Issues = "https://github.com/antonbabenko/repro-lambda/issues"
44
+
45
+ [build-system]
46
+ requires = ["hatchling"]
47
+ build-backend = "hatchling.build"
48
+
49
+ [tool.hatch.build.targets.wheel]
50
+ packages = ["src/repro_lambda"]
51
+
52
+ [tool.ruff]
53
+ line-length = 100
54
+ target-version = "py311"
55
+
56
+ [tool.ruff.lint]
57
+ select = ["E", "F", "I", "B", "UP", "SIM"]
58
+
59
+ [tool.pytest.ini_options]
60
+ testpaths = ["tests"]
61
+ addopts = "-ra --strict-markers"
62
+ markers = ["docker: requires docker daemon"]
@@ -0,0 +1,3 @@
1
+ """repro-lambda — reproducible AWS Lambda packaging outside Terraform."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,6 @@
1
+ """Allow `python -m repro_lambda ...` invocation."""
2
+
3
+ from repro_lambda.cli import app
4
+
5
+ if __name__ == "__main__":
6
+ app()