fix(python): add --no-emit-project to uv export to exclude root project from requirements by czubocha · Pull Request #13348 · serverless/serverless

📝 Walkthrough

Walkthrough

This PR adds the --no-emit-project flag to the uv export command and introduces comprehensive test coverage for uv path dependency handling with Docker-based packaging support. Includes a new test fixture with local Python packages and updated test assertions for dependency handling.

Changes

Cohort / File(s) Summary
uv Command Enhancement
packages/serverless/lib/plugins/python/lib/uv.js
Adds --no-emit-project flag to the uv export command in uvToRequirements function to modify command semantics when exporting requirements from uv.lock.
Test Assertions & Validation
packages/sf-core/tests/python/test.js
Updates test cases for uv installer with Docker packaging, validates path dependency handling with renamed artifacts (my_path_package), confirms proper Flask and boto3 packaging, and inspects resulting zip content for expected files and metadata.
uv Path Dependency Test Fixture
packages/sf-core/tests/python/tests/uv_path_dependency/...
Adds complete test scenario including Serverless configuration for Python 3.13, project metadata definitions, local package structure with version management, and Lambda handler that consumes the path dependency.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A flag hops in, --no-emit-project calls,
Test paths emerge from dependency halls,
my_path_package dances through Docker's embrace,
Version and Flask find their rightful place! 📦✨

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (5 files):

⚔️ package-lock.json (content)
⚔️ packages/serverless/lib/plugins/python/lib/uv.js (content)
⚔️ packages/sf-core-installer/package.json (content)
⚔️ packages/sf-core/package.json (content)
⚔️ packages/sf-core/tests/python/test.js (content)

These conflicts must be resolved before merging into main.

Resolve conflicts locally and push changes to this branch.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately and specifically describes the primary change—adding the --no-emit-project flag to the uv export command to exclude root project from requirements—which is the core technical change reflected in the uv.js modification.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sc-3829
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch sc-3829
  • Create stacked PR with resolved conflicts
  • Post resolved changes as copyable diffs in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.