Skip to content

fix(python-uv): replay exclude-newer-package opt-outs as lowercase false - #967

Merged
bnusunny merged 2 commits into
aws:developfrom
bnusunny:fix/python-uv-exclude-newer-package-false
Nov 16, 2026
Merged

bnusunny merged 2 commits into
aws:developfrom
bnusunny:fix/python-uv-exclude-newer-package-false

Conversation

@bnusunny

Copy link
Copy Markdown
Contributor

Issue #, if available: N/A. Fixes a regression from #954.

Description of changes

A project can let one package skip the exclude-newer cutoff:

[tool.uv]
exclude-newer = "2024-01-01"
exclude-newer-package = { six = false }

uv writes this into uv.lock as a TOML boolean (six = false). _lock_export_options replays the lock's options when it calls uv export, and it turned the Python value False into --exclude-newer-package six=False. uv only accepts lowercase false, so the build failed for any project with an opt-out:

error: invalid value 'six=False' for '--exclude-newer-package <EXCLUDE_NEWER_PACKAGE>': Invalid `exclude-newer-package` value `False`: `False` could not be parsed as a valid exclude-newer value

This change sends false instead. Dates and spans work the same as before. uv rejects true both in pyproject.toml and on the command line, so false is the only boolean we need to handle.

Description of how you validated changes

  • Reproduced the failure with uv 0.13.8 and LambdaBuilder before the fix. After the fix the same project builds.
  • Unit test: an opt-out in the lock is replayed as six=false.
  • Integration tests with real uv: added an opt-out case to test_workflow_preserves_existing_lock_options, plus a new test checking that an opted-out package (six) resolves past a 2020 cutoff to 1.17.0. Both new tests fail without the fix.
  • make lint, make black-check, make test (1114 passed, 95.2% coverage), and the python_uv integration suite (62 passed) all pass.

Checklist

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

A uv.lock records a package opted out of the exclude-newer cutoff as a TOML
boolean (six = false). Formatting it with an f-string produced six=False,
which uv rejects, so uv export failed for any project with an opt-out.
Emit the lowercase spelling uv accepts.
@bnusunny
bnusunny requested a review from a team as a code owner November 14, 2026 19:57
@aws-sam-tooling-bot

aws-sam-tooling-bot Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

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

Commit 16b9d02 · build LambdaToolingHandsOn-NoDocker:0d8b01d9-e854-4232-92a8-2279d3808f18. 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 path from the PR description: a global exclude-newer of 2020-01-01 with exclude-newer-package { six = false }. The… ✅ pass Project with exclude-newer = "2020-01-01" and exclude-newer-package = { six = false }. uv 0.13.8 uv lock --python 3.13 (managed CPython 3.13.18) wrote [options.exclude-newer-package] six = false. H…
S2 Check the exact arguments _lock_export_options builds from the real uv.lock written in S1. ✅ pass _lock_export_options on the S1 uv.lock. Head: ['--exclude-newer', '2020-01-02T00:00:00Z', '--exclude-newer-package', 'six=false']. Base: same list but 'six=False'. The cutoff string 2020-01-02T00:00:…
S3 Existing configs must keep working: a per-package date cutoff and a per-package span cutoff should build as before. ✅ pass Per-package date cutoff (six = "2023-01-01", lock records 2023-01-02T00:00:00Z) and span cutoff (six = "30 days", lock records {timestamp, span = "P30D"}). Head and base both build with EXIT=0: date …
S4 Mixed table: one package opted out (six = false) and another with a date cutoff (idna) in the same lock. Each entry sho… ✅ pass Mixed table { six = false, idna = "2023-01-01" } with global 2020-01-01. Head args: ['--exclude-newer', '2020-01-02T00:00:00Z', '--exclude-newer-package', 'idna=2023-01-02T00:00:00Z', '--exclude-newe…
S5 Same opt-out build with the build-performance experimental flag, since the integration tests run both flag sets. ✅ pass S1 project built with experimental flag experimentalBuildPerformance. Head: EXIT=0, ARTIFACTS include six-1.17.0.dist-info. Base: WorkflowFailedError with the 'six=False' uv error, EXIT=1.
S6 Run the repo's own tests for the changed code: the lock-export unit tests and the python_uv integration tests the PR ad… ✅ pass Unit: tests/unit/workflows/python_uv/test_packager.py -k lock_export gave 5 passed, exit 0, including test_lock_export_replays_package_opt_out_as_lowercase_false. Integration: test_python_uv.py -k 'p…
Runner's notes in full
  • S1: Project with exclude-newer = "2020-01-01" and exclude-newer-package = { six = false }. uv 0.13.8 uv lock --python 3.13 (managed CPython 3.13.18) wrote [options.exclude-newer-package] six = false. Head: LambdaBuilder(dependency_manager='uv') build EXIT=0, ARTIFACTS include six.py and six-1.17.0.dist-info. Base (same uv.lock): WorkflowFailedError PythonUvBuilder:ResolveDependencies with uv's "invalid value 'six=False' for '--exclude-newer-package '", EXIT=1. The PR fixes the regression. Projects were created under /work/scratch/hot instead of /tmp/hot.
  • S2: _lock_export_options on the S1 uv.lock. Head: ['--exclude-newer', '2020-01-02T00:00:00Z', '--exclude-newer-package', 'six=false']. Base: same list but 'six=False'. The cutoff string 2020-01-02T00:00:00Z is what uv itself recorded in the lock for 2020-01-01, and both trees show it.
  • S3: Per-package date cutoff (six = "2023-01-01", lock records 2023-01-02T00:00:00Z) and span cutoff (six = "30 days", lock records {timestamp, span = "P30D"}). Head and base both build with EXIT=0: date project gives six-1.16.0.dist-info, span project gives six-1.17.0.dist-info. No invalid --exclude-newer-package errors.
  • S4: Mixed table { six = false, idna = "2023-01-01" } with global 2020-01-01. Head args: ['--exclude-newer', '2020-01-02T00:00:00Z', '--exclude-newer-package', 'idna=2023-01-02T00:00:00Z', '--exclude-newer-package', 'six=false']; build EXIT=0 with idna-3.4.dist-info and six-1.17.0.dist-info. Base args show 'six=False' and the build fails with uv's invalid value error, EXIT=1. The first base run (10-base-s4-mixed) ran in parallel before the lock existed and printed []. The rerun (11-base-s4-mixed-rerun) is the valid base result.
  • S6: Unit: tests/unit/workflows/python_uv/test_packager.py -k lock_export gave 5 passed, exit 0, including test_lock_export_replays_package_opt_out_as_lowercase_false. Integration: test_python_uv.py -k 'preserves_existing_lock_options or honors_package_opt_out' gave 22 passed, 0 skipped, exit 0, for both TestPythonUvWorkflow_0 and _1_experimentalBuildPerformance. The new ('2024-01-01', 'false') cases are parametrizations 8 and 9 and passed. The '--locked' errors in the captured logs come from the passing changed=True cases, which expect a stale-lock failure.

🤖 Automated hands-on test — not a review approval · model claude-opus-5.5 · Kiro kiro-cli 2.33.1 · build LambdaToolingHandsOn-NoDocker:0d8b01d9-e854-4232-92a8-2279d3808f18 · commit 16b9d02

History (2)
Commit Result When (UTC) Build
16b9d02 No problems observed 2026-11-16 22:03 LambdaToolingHandsOn-NoDocker:0d8b01d9-e854-4232-92a8-2279d3808f18
3504573 No problems observed 2026-11-14 20:03 LambdaToolingHandsOn-NoDocker:3c9189ac-3c18-4f47-82d8-47822edfaceb

@bnusunny
bnusunny merged commit 253fad6 into aws:develop Nov 16, 2026
125 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