@vercel/python 6.25.0 → 6.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +35 -38
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -3227,7 +3227,7 @@ var import_fs11 = __toESM(require("fs"));
3227
3227
  var import_path13 = require("path");
3228
3228
 
3229
3229
  // src/package-versions.ts
3230
- var VERCEL_RUNTIME_VERSION = "0.10.0";
3230
+ var VERCEL_RUNTIME_VERSION = "0.10.1";
3231
3231
  var VERCEL_WORKERS_VERSION = "0.0.13";
3232
3232
 
3233
3233
  // src/index.ts
@@ -3331,34 +3331,16 @@ var UvRunner = class {
3331
3331
  args.push("--no-editable");
3332
3332
  await this.runUvCmd(args, projectDir, venvPath);
3333
3333
  }
3334
- async lock(projectDir, options) {
3335
- const args = ["lock"];
3336
- if (options?.noBuild) {
3334
+ async lock(options) {
3335
+ const { projectDir, venvPath, noBuild, upgrade } = options;
3336
+ const args = ["lock", "--python", getVenvPythonBin(venvPath)];
3337
+ if (noBuild) {
3337
3338
  args.push("--no-build");
3338
3339
  }
3339
- if (options?.upgrade) {
3340
+ if (upgrade) {
3340
3341
  args.push("--upgrade");
3341
3342
  }
3342
- const pretty = `uv ${args.join(" ")}`;
3343
- (0, import_build_utils.debug)(`Running "${pretty}" in ${projectDir}...`);
3344
- try {
3345
- await (0, import_execa.default)(this.uvPath, args, {
3346
- cwd: projectDir,
3347
- env: getProtectedUvEnv(process.env)
3348
- });
3349
- } catch (err) {
3350
- const error = new Error(
3351
- `Failed to run "${pretty}": ${err instanceof Error ? err.message : String(err)}`
3352
- );
3353
- if (err && typeof err === "object") {
3354
- if ("code" in err) {
3355
- error.code = err.code;
3356
- } else if ("signal" in err) {
3357
- error.code = err.signal;
3358
- }
3359
- }
3360
- throw error;
3361
- }
3343
+ await this.runUvCmd(args, projectDir, venvPath);
3362
3344
  }
3363
3345
  async addDependencies(options) {
3364
3346
  const { venvPath, projectDir, dependencies } = options;
@@ -4017,6 +3999,7 @@ function detectInstallSource(pythonPackage, rootDir) {
4017
3999
  async function ensureUvProject({
4018
4000
  workPath,
4019
4001
  rootDir,
4002
+ venvPath,
4020
4003
  pythonPackage,
4021
4004
  pythonVersion,
4022
4005
  uv,
@@ -4073,16 +4056,18 @@ async function ensureUvProject({
4073
4056
  if (workspaceLockFile) {
4074
4057
  lockPath = (0, import_path5.join)(rootDir, workspaceLockFile.path);
4075
4058
  } else {
4076
- await uv.lock(
4059
+ await uv.lock({
4077
4060
  projectDir,
4078
- requireBinaryWheels ? { noBuild: true, upgrade: true } : void 0
4079
- );
4061
+ venvPath,
4062
+ ...requireBinaryWheels ? { noBuild: true, upgrade: true } : {}
4063
+ });
4080
4064
  }
4081
4065
  if (generateLockFile && !lockPath) {
4082
- await uv.lock(
4066
+ await uv.lock({
4083
4067
  projectDir,
4084
- requireBinaryWheels ? { noBuild: true, upgrade: true } : void 0
4085
- );
4068
+ venvPath,
4069
+ ...requireBinaryWheels ? { noBuild: true, upgrade: true } : {}
4070
+ });
4086
4071
  }
4087
4072
  } else {
4088
4073
  projectDir = workPath;
@@ -4098,10 +4083,11 @@ async function ensureUvProject({
4098
4083
  });
4099
4084
  const content = (0, import_python_analysis2.stringifyManifest)(minimalManifest);
4100
4085
  await import_fs3.default.promises.writeFile(pyprojectPath, content);
4101
- await uv.lock(
4086
+ await uv.lock({
4102
4087
  projectDir,
4103
- requireBinaryWheels ? { noBuild: true, upgrade: true } : void 0
4104
- );
4088
+ venvPath,
4089
+ ...requireBinaryWheels ? { noBuild: true, upgrade: true } : {}
4090
+ });
4105
4091
  }
4106
4092
  const resolvedLockPath = lockPath && import_fs3.default.existsSync(lockPath) ? lockPath : (0, import_path5.join)(projectDir, "uv.lock");
4107
4093
  return {
@@ -4418,6 +4404,19 @@ To fix this, either:
4418
4404
  runtimeToolingOverhead = 50 * 1024 * 1024;
4419
4405
  }
4420
4406
  }
4407
+ runtimeToolingOverhead += 4 * 1024;
4408
+ const projectDirRel = (0, import_path6.relative)(this.workPath, this.uvProjectDir);
4409
+ const uvLockRel = (0, import_path6.relative)(this.workPath, this.uvLockPath);
4410
+ const isOutsideWorkPath = projectDirRel.startsWith("..") || uvLockRel.startsWith("..");
4411
+ if (isOutsideWorkPath) {
4412
+ const pyprojectPath = (0, import_path6.join)(this.uvProjectDir, "pyproject.toml");
4413
+ const pyprojectStats = await import_fs4.default.promises.stat(pyprojectPath).catch(() => null);
4414
+ const uvLockStats = await import_fs4.default.promises.stat(this.uvLockPath).catch(() => null);
4415
+ if (pyprojectStats)
4416
+ runtimeToolingOverhead += pyprojectStats.size;
4417
+ if (uvLockStats)
4418
+ runtimeToolingOverhead += uvLockStats.size;
4419
+ }
4421
4420
  const remainingCapacity = LAMBDA_SIZE_THRESHOLD_BYTES - fixedOverhead - runtimeToolingOverhead;
4422
4421
  (0, import_build_utils5.debug)(
4423
4422
  `Fixed overhead: ${(fixedOverhead / (1024 * 1024)).toFixed(2)} MB, runtime tooling: ${(runtimeToolingOverhead / (1024 * 1024)).toFixed(2)} MB, remaining capacity for public packages: ${(remainingCapacity / (1024 * 1024)).toFixed(2)} MB`
@@ -4446,9 +4445,6 @@ To fix this, either:
4446
4445
  ...this.alwaysBundlePackages,
4447
4446
  ...forceBundledDueToWheels
4448
4447
  ];
4449
- const projectDirRel = (0, import_path6.relative)(this.workPath, this.uvProjectDir);
4450
- const uvLockRel = (0, import_path6.relative)(this.workPath, this.uvLockPath);
4451
- const isOutsideWorkPath = projectDirRel.startsWith("..") || uvLockRel.startsWith("..");
4452
4448
  if (isOutsideWorkPath) {
4453
4449
  const srcPyproject = (0, import_path6.join)(this.uvProjectDir, "pyproject.toml");
4454
4450
  files[`${UV_BUNDLE_DIR}/pyproject.toml`] = new import_build_utils5.FileFsRef({
@@ -4488,7 +4484,7 @@ To fix this, either:
4488
4484
  }
4489
4485
  }
4490
4486
  const finalBundleSize = await calculateBundleSize(files);
4491
- if (finalBundleSize > LAMBDA_SIZE_THRESHOLD_BYTES) {
4487
+ if (finalBundleSize > LAMBDA_SIZE_THRESHOLD_BYTES + 100 * 1024) {
4492
4488
  const finalSizeMB = (finalBundleSize / (1024 * 1024)).toFixed(2);
4493
4489
  const limitMB = (LAMBDA_SIZE_THRESHOLD_BYTES / (1024 * 1024)).toFixed(0);
4494
4490
  throw new import_build_utils5.NowBuildError({
@@ -6636,6 +6632,7 @@ var build = async ({
6636
6632
  const { projectDir, lockPath, lockFileProvidedByUser } = await ensureUvProject({
6637
6633
  workPath,
6638
6634
  rootDir,
6635
+ venvPath,
6639
6636
  pythonPackage,
6640
6637
  pythonVersion: pythonVersionString(pythonVersion),
6641
6638
  uv,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/python",
3
- "version": "6.25.0",
3
+ "version": "6.26.0",
4
4
  "main": "./dist/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
@@ -38,7 +38,7 @@
38
38
  "which": "3.0.0",
39
39
  "@vercel/build-utils": "13.8.2",
40
40
  "@vercel/error-utils": "2.0.3",
41
- "@vercel/python-runtime": "0.10.0"
41
+ "@vercel/python-runtime": "0.10.1"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "node ../../utils/build-builder.mjs",