Skip to content

Commit e5282ec

Browse files
authored
fix(python-uv): pass --no-default-groups to uv export (#869)
PEP 735 dependency-groups.dev is included by default in uv export, so dev/test deps (moto, pytest, cryptography, docker, ...) currently land in every Lambda zip — ~67MB of bloat per function. Adding --no-default-groups mirrors the prior pip-tools behavior (extras/dev not auto-shipped) and cuts cold install time ~4-5x.
1 parent c62aade commit e5282ec

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

aws_lambda_builders/workflows/python_uv/packager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ def _build_from_lock_file(
329329
"requirements.txt",
330330
"--no-emit-project", # Don't include the project itself, only dependencies
331331
"--no-hashes", # Skip hashes for cleaner output (optional)
332+
"--no-default-groups", # Exclude PEP 735 default groups (e.g. dev/test) from Lambda zips
332333
"--output-file",
333334
temp_requirements,
334335
# We want to specify the version because `uv export` might default to using a different one

tests/unit/workflows/python_uv/test_packager.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,11 @@ def test_build_dependencies_pyproject_with_uv_lock(self):
242242
# Verify it checked for uv.lock in the right location
243243
mock_exists.assert_called_with(os.path.join("path", "to", "uv.lock"))
244244

245+
# Verify export excludes PEP 735 default dependency-groups (dev/test deps
246+
# must not land in Lambda zips).
247+
export_args = self.mock_uv_runner._uv.run_uv_command.call_args[0][0]
248+
self.assertIn("--no-default-groups", export_args)
249+
245250
def test_build_dependencies_pyproject_without_uv_lock(self):
246251
"""Test that pyproject.toml without uv.lock uses standard pyproject build."""
247252
with (

0 commit comments

Comments
 (0)