Skip to content

test: pin requires-python in the uv build fixture and refresh its lock - #9443

Merged
licjun merged 1 commit into
aws:developfrom
bnusunny:fix/uv-fixture-requires-python
Nov 17, 2026
Merged

licjun merged 1 commit into
aws:developfrom
bnusunny:fix/uv-fixture-requires-python

Conversation

@bnusunny

@bnusunny bnusunny commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Which issue(s) does this change fix?

Unblocks #9442 (update aws_lambda_builders to 1.70.0).

Why is this change necessary?

On #9442, integ-buildcmd-python and the Docker-disabled tests fail test_with_default_requirements for the PythonPyProject fixture on every runtime (3.9, 3.10, 3.12, 3.13, 3.14, 3.15):

uv warning: No `requires-python` value found in the workspace. Defaulting to `>=3.12`.
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided.

The fixture's pyproject.toml has no requires-python, so uv defaults it to the build interpreter's version. The committed uv.lock was locked against >=3.11, so it never matches. aws-lambda-builders 1.69.0 ran uv export without --locked and quietly re-resolved. 1.70.0 passes --locked (aws-lambda-builders#954) and rejects the stale lock.

How does it address the issue?

Sets requires-python = ">=3.9" in the fixture (the lowest runtime the test covers) and regenerates uv.lock with uv 0.13.9. The pinned versions are unchanged: numpy 2.0.0 / 2.1.3 / 2.3.4 / 2.5.4 by Python version, and cryptography 3.3.2. The lock gains the 3.9 and 3.10 resolution branches it was missing.

Checked locally:

  • uv lock --check passes for Python 3.9, 3.10, 3.12, 3.13, 3.14 and 3.15 (it failed before this change).
  • uv export --locked with the flags aws-lambda-builders uses succeeds for 3.9, 3.12 and 3.15.
  • Building the fixture with aws-lambda-builders 1.70.0 (python_uv, python3.12) installs numpy 2.1.3 and cryptography 3.3.2.

What side effects does this change have?

None outside the test fixture. With this merged first, #9442 should go green without other changes.

Mandatory Checklist

PRs will only be reviewed after checklist is complete

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

The PythonPyProject fixture sets no requires-python, so uv defaults it to
the build interpreter's version and the committed uv.lock (locked against
>=3.11) never matches. aws-lambda-builders 1.70.0 exports with --locked and
rejects the stale lock, failing test_with_default_requirements for every
runtime. Set requires-python = ">=3.9" (the lowest runtime tested) and
regenerate uv.lock.
@bnusunny
bnusunny requested a review from a team as a code owner November 17, 2026 18:39
@aws-sam-tooling-bot

Copy link
Copy Markdown

🧪 Hands-on test: No problems observed in 6 scenarios

Commit fc80b22 · build LambdaToolingHandsOn-NoDocker:b72e42a0-c4d6-41a7-a37a-9bcdff9b26a3. The plan's scenarios ran on an isolated build host; a problem is reported only if it reproduced at least twice. Passing scenarios show only that these checks behaved as expected, not that the change is correct.

Scenarios

Scenario Planned check Result Runner's note
S1 Main claim: the committed uv.lock is up to date with pyproject.toml for each Python version the integration tests cover… ✅ pass Head: uv lock --check passes for 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14 (uv 0.13.9, 'Resolved 12 packages'), the loop exits 0 with no requires-python warning, and the copied uv.lock is unchanged (LOC…
S2 The same lock check for Python 3.15, which the al2023 test class covers. This Python may not be installable in the sand… ✅ pass CPython 3.15.2 installed through uv. Head: uv lock --check --python 3.15 exits 0 ('Resolved 12 packages'). Base: exits 1 with 'The lockfile at uv.lock needs to be updated'. On base, the PY315_UNA…
S3 uv export --locked succeeds on the lock (aws-lambda-builders 1.70.0 now passes --locked), and the exported requirements… ✅ pass Head: uv export --locked exits 0 for 3.9, 3.12 and 3.14. req-3.12.txt has cryptography==3.3.2, numpy 2.0.0 (<3.10), 2.1.3 (>=3.10,<3.14), 2.3.4 (==3.14.*) and 2.5.4 (>=3.15), cffi 2.0.0 and 2.1.1, …
S4 The user-facing path from the failing CI job: sam build of the PythonPyProject fixture with BuildMethod python-uv, --be… ✅ pass sam build (python_uv, --beta-features, python3.12, aws-lambda-builders 1.70.0, no Docker). Head: 'Build Succeeded', exit 0. The artifact has main.py, __init__.py, pyproject.toml, numpy/, cryptography…
S5 Build on python3.10 to exercise the newly added 3.10 versions (numpy 2.1.3, cffi 2.1.1, pycparser 3.11), as covered by … ✅ pass sam build on python3.10. Head: 'Build Succeeded', exit 0. The artifact has numpy-2.1.3, cryptography-3.3.2, cffi-2.1.1 and pycparser-3.11 dist-info. The handler prints 2.1.3 and {'pi': '3.14'}. Base:…
S6 Build on python3.9, the new lowest bound in requires-python. This exercises the added numpy 2.0.0, cffi 2.0.0 and pycpa… ✅ pass sam build on python3.9; sam accepted the runtime. Head: 'Build Succeeded', exit 0. The artifact has numpy-2.0.0, cffi-2.0.0, pycparser-2.23 and cryptography-3.3.2 dist-info. The handler prints 2.0.0 …
Runner's notes in full
  • S1: Head: uv lock --check passes for 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14 (uv 0.13.9, 'Resolved 12 packages'), the loop exits 0 with no requires-python warning, and the copied uv.lock is unchanged (LOCK_UNCHANGED). Base: the loop exits 1 with 'needs to be updated, but --check was provided' and the 'No requires-python value found' warning for 3.9, 3.10, 3.12, 3.13 and 3.14. Base 3.11 passed, so not every version failed on base as the PR says.
  • S2: CPython 3.15.2 installed through uv. Head: uv lock --check --python 3.15 exits 0 ('Resolved 12 packages'). Base: exits 1 with 'The lockfile at uv.lock needs to be updated'. On base, the PY315_UNAVAILABLE line appears only because uv python find runs inside the copy, which has no requires-python. The check still ran on 3.15.2.
  • S3: Head: uv export --locked exits 0 for 3.9, 3.12 and 3.14. req-3.12.txt has cryptography==3.3.2, numpy 2.0.0 (<3.10), 2.1.3 (>=3.10,<3.14), 2.3.4 (==3.14.*) and 2.5.4 (>=3.15), cffi 2.0.0 and 2.1.1, and pycparser 2.23, 3.11 and 3.12, all with python_full_version markers. Base: the export for 3.9 fails with 'needs to be updated, but --locked was provided'.
  • S4: sam build (python_uv, --beta-features, python3.12, aws-lambda-builders 1.70.0, no Docker). Head: 'Build Succeeded', exit 0. The artifact has main.py, __init__.py, pyproject.toml, numpy/, cryptography/, numpy-2.1.3, cryptography-3.3.2, cffi-2.1.1 and pycparser-3.12 dist-info. The handler prints 2.1.3, a key line and {'pi': '3.14'}. Base: 'Build Failed', exit 1, with 'The lockfile at uv.lock needs to be updated, but --locked was provided'.
  • S5: sam build on python3.10. Head: 'Build Succeeded', exit 0. The artifact has numpy-2.1.3, cryptography-3.3.2, cffi-2.1.1 and pycparser-3.11 dist-info. The handler prints 2.1.3 and {'pi': '3.14'}. Base: 'Build Failed', exit 1, with the uv '--locked' lockfile error.
  • S6: sam build on python3.9; sam accepted the runtime. Head: 'Build Succeeded', exit 0. The artifact has numpy-2.0.0, cffi-2.0.0, pycparser-2.23 and cryptography-3.3.2 dist-info. The handler prints 2.0.0 and {'pi': '3.14'}. Base: 'Build Failed', exit 1, with the uv '--locked' lockfile error. Both trees print a uv warning about >=3.10 before the build. It comes from uv python find 3.9 reading the repo-root pyproject.toml (SAM CLI's own requires-python), not from the fixture (requires-python >=3.9), so it does not affect the build.

🤖 Automated hands-on test — not a review approval · model claude-opus-5.5 · Kiro kiro-cli 2.33.1 · build LambdaToolingHandsOn-NoDocker:b72e42a0-c4d6-41a7-a37a-9bcdff9b26a3 · commit fc80b22

History (1)
Commit Result When (UTC) Build
fc80b22 No problems observed 2026-11-17 18:45 LambdaToolingHandsOn-NoDocker:b72e42a0-c4d6-41a7-a37a-9bcdff9b26a3

@licjun
licjun added this pull request to the merge queue Nov 17, 2026
Merged via the queue into aws:develop with commit f606968 Nov 17, 2026
56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants