Skip to content

Commit f8826df

Browse files
committed
fix(python-uv): pass --no-default-groups to uv export
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 5bc95fa commit f8826df

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
@@ -331,6 +331,7 @@ def _build_from_lock_file(
331331
"requirements.txt",
332332
"--no-emit-project", # Don't include the project itself, only dependencies
333333
"--no-hashes", # Skip hashes for cleaner output (optional)
334+
"--no-default-groups", # Exclude PEP 735 default groups (e.g. dev/test) from Lambda zips
334335
"--output-file",
335336
temp_requirements,
336337
# 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
@@ -258,6 +258,11 @@ def test_build_dependencies_pyproject_with_uv_lock(self):
258258
# Verify it checked for uv.lock in the right location
259259
mock_exists.assert_called_with(os.path.join("path", "to", "uv.lock"))
260260

261+
# Verify export excludes PEP 735 default dependency-groups (dev/test deps
262+
# must not land in Lambda zips).
263+
export_args = self.mock_uv_runner._uv.run_uv_command.call_args[0][0]
264+
self.assertIn("--no-default-groups", export_args)
265+
261266
def test_build_dependencies_pyproject_without_uv_lock(self):
262267
"""Test that pyproject.toml without uv.lock uses standard pyproject build."""
263268
with (

0 commit comments

Comments
 (0)