Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Pull request overview
This PR adds automatic reinstallation support for local Python packages when using the uv installer to address a known uv caching issue where local packages aren't reinstalled when source files change. The implementation detects local packages by parsing pyproject.toml files and adds --reinstall-package flags to force their reinstallation.
- Enhanced pip.js with logic to detect and force reinstall local packages
- Added comprehensive test case validating that source changes in local packages are correctly packaged
- Introduced TOML parsing to extract package names from pyproject.toml files
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/serverless/lib/plugins/python/lib/pip.js | Added getLocalPackagesFromRequirements and getPackageNameFromPyproject functions to detect local packages and force their reinstallation with uv's --reinstall-package flag |
| packages/sf-core/tests/python/test.js | Added test case that modifies a local package's source and verifies the changes are reflected in the packaged artifact |
| packages/sf-core/tests/python/tests/uv_local_package/pyproject.toml | Test fixture defining a local Python package with Flask dependency |
| packages/sf-core/tests/python/tests/uv_local_package/serverless.yml | Serverless configuration for test using uv installer |
| packages/sf-core/tests/python/tests/uv_local_package/handler.py | Lambda handler importing and using the local package |
| packages/sf-core/tests/python/tests/uv_local_package/src/my_local_package/init.py | Local package implementation with version information for testing |
| packages/sf-core/tests/python/tests/uv_local_package/uv.lock | UV lock file with package dependencies including the local package as editable source |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Closes #13169
Mitigates known uv behavior: astral-sh/uv#13876
Summary
This Pull Request enables automatic reinstallation of local Python packages when using the uv installer.
Because uv does not currently reinstall path-based dependencies even if source files change (see workaround context below), this PR introduces logic to detect local packages and explicitly force their reinstallation. This ensures that source changes are always reflected in the packaged artifacts, preventing "stale" deployments.
Main Changes
Enhanced pip.js
--reinstall-packageflags for local path dependencies to address uv#13876.requirements.txt.New Tests