-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swap pip for uv #830
Comments
Hey @lmmx - how do you imagine support for |
uv doesn't (yet) support the This flag is used by this project to install the requirements into a cache directory or if you've disabled the cache to have the requirements under .serverless/requirements. Zer0x00 ➜ /project $ uv pip install -t /project/.serverless/requirements -r /project/.serverless/requirements/requirements.txt
error: unexpected argument '-t' found
tip: to pass '-t' as a value, use '-- -t'
Usage: uv pip install [OPTIONS] <PACKAGE|--requirement <REQUIREMENT>|--editable <EDITABLE>>
For more information, try '--help'. |
Thanks for sharing @Zer0x00 🙇 Unless there will be a very high demand for If anyone is interested in having support for |
This is something I really would like to see supported. I have recently transitioned from using I have had success patching diff --git a/node_modules/serverless-python-requirements/lib/pip.js b/node_modules/serverless-python-requirements/lib/pip.js
index 40140d3..bfc75ab 100644
--- a/node_modules/serverless-python-requirements/lib/pip.js
+++ b/node_modules/serverless-python-requirements/lib/pip.js
@@ -147,7 +147,7 @@ async function installRequirements(targetFolder, pluginInstance, funcOptions) {
try {
const dockerCmd = [];
- const pipCmd = [options.pythonBin, '-m', 'pip', 'install'];
+ const pipCmd = ['uv', 'pip', 'install', '--verbose', '--system'];
if (
Array.isArray(options.pipCmdExtraArgs) &&
@@ -159,7 +159,10 @@ async function installRequirements(targetFolder, pluginInstance, funcOptions) {
});
}
- const pipCmds = [pipCmd];
+ const pipCmds = [
+ [options.pythonBin, '-m', 'pip', 'install', 'uv'],
+ pipCmd
+ ];
const postCmds = [];
// Check if we're using the legacy --cache-dir command...
if (options.pipCmdExtraArgs.indexOf('--cache-dir') > -1) {
@@ -196,9 +199,9 @@ async function installRequirements(targetFolder, pluginInstance, funcOptions) {
if (!options.dockerizePip) {
// Push our local OS-specific paths for requirements and target directory
pipCmd.push(
- '-t',
+ '--target',
dockerPathForWin(targetFolder),
- '-r',
+ '--requirement',
dockerPathForWin(targetRequirementsTxt)
);
// If we want a download cache...
@@ -226,7 +229,7 @@ async function installRequirements(targetFolder, pluginInstance, funcOptions) {
// If we are dockerizing pip
if (options.dockerizePip) {
// Push docker-specific paths for requirements and target directory
- pipCmd.push('-t', '/var/task/', '-r', '/var/task/requirements.txt');
+ pipCmd.push('--target', '/var/task/', '--requirement', '/var/task/requirements.txt');
// Build docker image if required
let dockerImage; |
Just a quick note
This was the idea for the initial release of uv, but now it supports lots of new functionality beyond pip. I'm not sure if that changes anything here :) |
It is also now able to replace I would imagine that |
Is there an existing issue for this?
Use case description
uv
was just released (from the makers ofruff
), and is substantially faster than pip, pip-tools, and virtualenv. This seems desirable to speed up serverless builds.Proposed solution (optional)
— Source
The “drop-in” claim seems to suggest you might be able to just change the binary i.e. re-alias
pip
touv pip
The text was updated successfully, but these errors were encountered: