Skip to content

lambdas: do not install test deps in .zip package#4659

Merged
sir-sigurd merged 3 commits intomasterfrom
fix-lambda-zips
Dec 8, 2025
Merged

lambdas: do not install test deps in .zip package#4659
sir-sigurd merged 3 commits intomasterfrom
fix-lambda-zips

Conversation

@sir-sigurd
Copy link
Copy Markdown
Member

@sir-sigurd sir-sigurd commented Dec 5, 2025

Greptile Overview

Greptile Summary

Excluded test dependencies from lambda deployment packages by adding --no-default-groups flag to uv export commands.

  • Fixed critical issue where test dependencies (pytest, pytest-cov, pytest-mock, etc.) were being bundled into production lambda .zip packages
  • All lambda pyproject.toml files have default-groups = ["test"] which was causing test deps to be included by default
  • Changes applied to both CI test workflow and production build script for consistency
  • Reduces lambda package size and eliminates unnecessary dependencies in production environment

Confidence Score: 5/5

  • This PR is safe to merge with no risks - it's a targeted fix that removes unwanted dependencies
  • The change correctly addresses a real production issue where test dependencies were bloating lambda packages. The --no-default-groups flag is the proper uv command for excluding default dependency groups. Both CI and production build scripts are updated consistently.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
.github/workflows/py-ci.yml 5/5 Added --no-default-groups flag to requirements export to exclude test dependencies from production builds, matching the build_zip.sh change
lambdas/scripts/build_zip.sh 5/5 Added --no-default-groups flag to prevent test dependencies from being included in lambda deployment packages

Sequence Diagram

sequenceDiagram
    participant GH as GitHub Actions
    participant UV as uv (package manager)
    participant Build as build_zip.sh
    participant Lambda as Lambda Package

    Note over GH,Lambda: CI Test Flow (.github/workflows/py-ci.yml)
    GH->>UV: uv export --no-default-groups<br/>(production deps only)
    UV-->>GH: requirements.txt
    GH->>UV: uv export --only-group test
    UV-->>GH: test-requirements.txt
    GH->>GH: Install production deps to deps/
    GH->>GH: Install test deps separately
    GH->>GH: Run pytest with both sets

    Note over Build,Lambda: Production Build Flow (build_zip.sh)
    Build->>UV: uv export --no-default-groups<br/>(production deps only)
    UV-->>Build: requirements.txt
    Build->>Build: uv pip install --target .
    Build->>Build: Compile, strip, cleanup
    Build->>Lambda: Create deployment .zip<br/>(no test deps)
Loading

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 40.58%. Comparing base (11258ec) to head (51d4e1d).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4659      +/-   ##
==========================================
+ Coverage   36.71%   40.58%   +3.86%     
==========================================
  Files         865      899      +34     
  Lines       35433    37882    +2449     
  Branches     6238     6238              
==========================================
+ Hits        13009    15374    +2365     
- Misses      21153    21237      +84     
  Partials     1271     1271              
Flag Coverage Δ
api-python 91.66% <ø> (ø)
catalog 21.82% <ø> (ø)
lambda 96.57% <ø> (?)
py-shared 98.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sir-sigurd
Copy link
Copy Markdown
Member Author

@greptileai

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@sir-sigurd sir-sigurd marked this pull request as ready for review December 8, 2025 05:04
This reverts commit 41c8afa.
@sir-sigurd
Copy link
Copy Markdown
Member Author

@greptileai

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@sir-sigurd sir-sigurd requested a review from nl0 December 8, 2025 05:15
@sir-sigurd sir-sigurd enabled auto-merge December 8, 2025 12:32
@sir-sigurd sir-sigurd requested a review from drernie December 8, 2025 13:08
@sir-sigurd sir-sigurd added this pull request to the merge queue Dec 8, 2025
Merged via the queue into master with commit 3abad0b Dec 8, 2025
46 checks passed
@sir-sigurd sir-sigurd deleted the fix-lambda-zips branch December 8, 2025 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants