Skip to content

Comments

fix(python): add --no-emit-project to uv export to exclude root project from requirements#13348

Merged
czubocha merged 2 commits intomainfrom
sc-3829
Feb 17, 2026
Merged

fix(python): add --no-emit-project to uv export to exclude root project from requirements#13348
czubocha merged 2 commits intomainfrom
sc-3829

Conversation

@czubocha
Copy link
Contributor

@czubocha czubocha commented Feb 13, 2026

Summary

  • Add --no-emit-project flag to uv export command so the root project itself is not emitted as a -e . requirement in the generated requirements.txt
  • Split uv_local_package test into two focused test cases: root project exclusion and path dependency force-reinstall
  • Add new uv_path_dependency test fixture with a realistic editable local package structure
  • Expand uv_installer test to validate Docker-based packaging with proper assertions instead of noThrow: true

Root cause

Without --no-emit-project, uv export includes the root project as an editable dependency (-e .) in the requirements output. This causes uv pip install to fail inside Docker containers where pyproject.toml/setup.py are not present in the build context, producing confusing metadata errors.

Test plan

  • uv_local_package test validates root project is excluded from the packaged artifact
  • uv_path_dependency test validates local path dependencies are included and force-reinstalled on source changes
  • uv_installer test validates Docker-based packaging succeeds without -e stripping warnings or metadata errors
  • Zip contents are inspected for expected files (flask/__init__.py, boto3/__init__.py, my_path_package/__init__.py)

Related

Fixes #13346

Summary by CodeRabbit

  • New Features

    • Enhanced support for local path dependencies in Python projects using uv package manager.
  • Tests

    • Expanded test coverage for path dependency handling and Docker-based packaging scenarios.
    • Added validation for proper inclusion of local packages in deployment artifacts.

Note

Medium Risk
Touches dependency export behavior for uv projects and adds new Docker/path-dependency test coverage; risk is mainly around potentially changing which dependencies end up in packaged artifacts.

Overview
Fixes uv-based Python packaging by adding --no-emit-project to the uv export command so the generated requirements.txt no longer includes the root project as an editable -e . entry (avoiding Docker build-context metadata failures).

Tests are updated to cover this behavior and local editable path dependencies: the prior uv_installer test is replaced with a Dockerized packaging assertion, uv_local_package now verifies the root project isn’t injected into the artifact, and a new uv_path_dependency fixture/test validates force-reinstall + packaging of an editable local path dependency.

Written by Cursor Bugbot for commit de3eba6. This will update automatically on new commits. Configure here.

@Mmarzex
Copy link
Contributor

Mmarzex commented Feb 13, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 13, 2026

📝 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/serverless/lib/plugins/python/lib/uv.js`:
- Around line 73-81: getUvVersion() currently only checks uv
existence/parseability but not minimum version; update getUvVersion() to enforce
uv >= 0.4.7 and throw a clear, actionable error if the detected version is older
(mention required flag --no-emit-project introduced in 0.4.7). Locate the
function getUvVersion() and add semantic version comparison (>= "0.4.7") after
parsing, or normalize and compare major/minor/patch, and ensure the error
message references the flag and required uv version; alternatively, add
equivalent validation where the args array containing '--no-emit-project' is
constructed so callers fail fast with a clear message.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de3eba6b4e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@czubocha czubocha changed the title Add uv no-emit-project flag and expand python installer tests fix(python): add --no-emit-project to uv export to exclude root project from requirements Feb 13, 2026
@czubocha
Copy link
Contributor Author

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@czubocha czubocha requested a review from eahefnawy February 13, 2026 15:23
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 03f2e69bff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@czubocha czubocha merged commit d219b98 into main Feb 17, 2026
13 checks passed
@czubocha czubocha deleted the sc-3829 branch February 17, 2026 20:14
@github-actions github-actions bot locked and limited conversation to collaborators Feb 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using uv for python requirements broken

2 participants