@vercel/python 6.44.1 → 6.45.1
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.
- package/dist/index.js +69 -192
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4614,14 +4614,7 @@ var OTEL_LAYER_RESERVATION_BYTES = 5 * 1024 * 1024;
|
|
|
4614
4614
|
var LAMBDA_SIZE_THRESHOLD_BYTES = process.env.VERCEL_DEPLOYMENT_HAS_OTEL_LAYER === "1" ? LAMBDA_BASE_SIZE_THRESHOLD_BYTES - OTEL_LAYER_RESERVATION_BYTES : LAMBDA_BASE_SIZE_THRESHOLD_BYTES;
|
|
4615
4615
|
var LAMBDA_EPHEMERAL_STORAGE_BYTES = 500 * 1024 * 1024;
|
|
4616
4616
|
var HIVE_LAMBDA_SIZE_BYTES = 1 * 1024 * 1024 * 1024;
|
|
4617
|
-
var FUNCTIONS_BETA_CTA = "Run `vercel deploy --functions-beta` to use extended function limits (up to 1 GB), or reduce your dependency footprint.";
|
|
4618
4617
|
var BUNDLING_DOCS_LINK = "https://vercel.com/docs/functions/runtimes/python#controlling-what-gets-bundled";
|
|
4619
|
-
var FUNCTIONS_BETA_DOCS_LINK = "https://vercel.com/docs/functions/runtimes/python#extended-size-limits-with-functions-beta";
|
|
4620
|
-
var FUNCTIONS_BETA_EXCEEDED_CTA = "Your deployment is already using extended function limits (`--functions-beta`).\nReduce your dependency footprint to under 1 GB or split your application\ninto smaller functions.";
|
|
4621
|
-
function shouldShowFunctionsBetaHint() {
|
|
4622
|
-
const v = process.env.VERCEL_FUNCTIONS_BETA_HINT;
|
|
4623
|
-
return v === "1" || v === "true";
|
|
4624
|
-
}
|
|
4625
4618
|
var PythonDependencyExternalizer = class {
|
|
4626
4619
|
constructor(options) {
|
|
4627
4620
|
// Populated by analyze()
|
|
@@ -4687,9 +4680,7 @@ var PythonDependencyExternalizer = class {
|
|
|
4687
4680
|
const limitMB = (LAMBDA_SIZE_THRESHOLD_BYTES / (1024 * 1024)).toFixed(0);
|
|
4688
4681
|
throw new import_build_utils7.NowBuildError({
|
|
4689
4682
|
code: "LAMBDA_SIZE_EXCEEDED",
|
|
4690
|
-
message:
|
|
4691
|
-
|
|
4692
|
-
` + FUNCTIONS_BETA_CTA : `Total bundle size (${totalBundleSizeMB} MB) exceeds the size limit (${limitMB} MB).
|
|
4683
|
+
message: `Total bundle size (${totalBundleSizeMB} MB) exceeds the size limit (${limitMB} MB).
|
|
4693
4684
|
|
|
4694
4685
|
When using a custom install command, Vercel cannot automatically
|
|
4695
4686
|
optimize dependency bundling. To reduce the size of your
|
|
@@ -4697,7 +4688,7 @@ dependencies, you can:
|
|
|
4697
4688
|
1. Remove unused dependencies from your project.
|
|
4698
4689
|
2. Remove the custom install command to allow Vercel to manage
|
|
4699
4690
|
and optimize dependencies automatically.`,
|
|
4700
|
-
link:
|
|
4691
|
+
link: BUNDLING_DOCS_LINK,
|
|
4701
4692
|
action: "Learn More"
|
|
4702
4693
|
});
|
|
4703
4694
|
}
|
|
@@ -4705,13 +4696,11 @@ dependencies, you can:
|
|
|
4705
4696
|
const limitMB = (HIVE_LAMBDA_SIZE_BYTES / (1024 * 1024)).toFixed(0);
|
|
4706
4697
|
throw new import_build_utils7.NowBuildError({
|
|
4707
4698
|
code: "LAMBDA_SIZE_EXCEEDED",
|
|
4708
|
-
message:
|
|
4709
|
-
|
|
4710
|
-
` + FUNCTIONS_BETA_EXCEEDED_CTA : `Total bundle size (${totalBundleSizeMB} MB) exceeds the extended function size limit (${limitMB} MB).
|
|
4699
|
+
message: `Total bundle size (${totalBundleSizeMB} MB) exceeds the extended function size limit (${limitMB} MB).
|
|
4711
4700
|
|
|
4712
4701
|
Consider removing unused dependencies or splitting your
|
|
4713
4702
|
application into smaller functions.`,
|
|
4714
|
-
link:
|
|
4703
|
+
link: BUNDLING_DOCS_LINK,
|
|
4715
4704
|
action: "Learn More"
|
|
4716
4705
|
});
|
|
4717
4706
|
}
|
|
@@ -4747,15 +4736,13 @@ application into smaller functions.`,
|
|
|
4747
4736
|
const ephemeralLimitMB = (LAMBDA_EPHEMERAL_STORAGE_BYTES / (1024 * 1024)).toFixed(0);
|
|
4748
4737
|
throw new import_build_utils7.NowBuildError({
|
|
4749
4738
|
code: "LAMBDA_SIZE_EXCEEDED",
|
|
4750
|
-
message:
|
|
4751
|
-
|
|
4752
|
-
` + FUNCTIONS_BETA_CTA : `Total bundle size (${totalBundleSizeMB} MB) exceeds Lambda ephemeral storage limit (${ephemeralLimitMB} MB).
|
|
4739
|
+
message: `Total bundle size (${totalBundleSizeMB} MB) exceeds Lambda ephemeral storage limit (${ephemeralLimitMB} MB).
|
|
4753
4740
|
|
|
4754
4741
|
Even with runtime dependency installation, all packages must fit
|
|
4755
4742
|
within the ${ephemeralLimitMB} MB ephemeral storage available to Lambda
|
|
4756
4743
|
functions. Consider removing unused dependencies or splitting
|
|
4757
4744
|
your application into smaller functions.`,
|
|
4758
|
-
link:
|
|
4745
|
+
link: BUNDLING_DOCS_LINK,
|
|
4759
4746
|
action: "Learn More"
|
|
4760
4747
|
});
|
|
4761
4748
|
}
|
|
@@ -4946,15 +4933,13 @@ To fix this, either:
|
|
|
4946
4933
|
const limitMB = (LAMBDA_SIZE_THRESHOLD_BYTES / (1024 * 1024)).toFixed(0);
|
|
4947
4934
|
throw new import_build_utils7.NowBuildError({
|
|
4948
4935
|
code: "LAMBDA_SIZE_EXCEEDED",
|
|
4949
|
-
message:
|
|
4950
|
-
|
|
4951
|
-
` + FUNCTIONS_BETA_CTA : `Total bundle size (${finalSizeMB} MB) exceeds Lambda limit (${limitMB} MB) even after
|
|
4936
|
+
message: `Total bundle size (${finalSizeMB} MB) exceeds Lambda limit (${limitMB} MB) even after
|
|
4952
4937
|
deferring public packages to runtime installation.
|
|
4953
4938
|
|
|
4954
4939
|
This usually means your private packages or source code are too
|
|
4955
4940
|
large. Consider reducing the size of private dependencies or
|
|
4956
4941
|
splitting your application.`,
|
|
4957
|
-
link:
|
|
4942
|
+
link: BUNDLING_DOCS_LINK,
|
|
4958
4943
|
action: "Learn More"
|
|
4959
4944
|
});
|
|
4960
4945
|
}
|
|
@@ -6356,166 +6341,47 @@ async function runSync({
|
|
|
6356
6341
|
});
|
|
6357
6342
|
});
|
|
6358
6343
|
}
|
|
6359
|
-
var
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
pythonBin,
|
|
6365
|
-
env,
|
|
6366
|
-
onStdout,
|
|
6367
|
-
onStderr
|
|
6368
|
-
}) {
|
|
6369
|
-
const targetDir = (0, import_path10.join)(workPath, ".vercel", "python");
|
|
6370
|
-
let pending = PENDING_RUNTIME_INSTALLS.get(targetDir);
|
|
6371
|
-
if (!pending) {
|
|
6372
|
-
pending = doInstallVercelRuntime({
|
|
6373
|
-
targetDir,
|
|
6374
|
-
workPath,
|
|
6375
|
-
uvPath,
|
|
6376
|
-
pythonBin,
|
|
6377
|
-
env,
|
|
6378
|
-
onStdout,
|
|
6379
|
-
onStderr
|
|
6380
|
-
});
|
|
6381
|
-
PENDING_RUNTIME_INSTALLS.set(targetDir, pending);
|
|
6382
|
-
pending.finally(() => PENDING_RUNTIME_INSTALLS.delete(targetDir));
|
|
6383
|
-
}
|
|
6384
|
-
await pending;
|
|
6385
|
-
}
|
|
6386
|
-
async function doInstallVercelRuntime({
|
|
6387
|
-
targetDir,
|
|
6388
|
-
workPath,
|
|
6389
|
-
uvPath,
|
|
6390
|
-
pythonBin,
|
|
6391
|
-
env,
|
|
6392
|
-
onStdout,
|
|
6393
|
-
onStderr
|
|
6394
|
-
}) {
|
|
6395
|
-
(0, import_fs10.mkdirSync)(targetDir, { recursive: true });
|
|
6396
|
-
const localRuntimeDir = (0, import_path10.join)(
|
|
6397
|
-
__dirname,
|
|
6398
|
-
"..",
|
|
6399
|
-
"..",
|
|
6400
|
-
"..",
|
|
6401
|
-
"python",
|
|
6402
|
-
"vercel-runtime"
|
|
6403
|
-
);
|
|
6404
|
-
const isLocalDev = (0, import_fs10.existsSync)((0, import_path10.join)(localRuntimeDir, "pyproject.toml"));
|
|
6405
|
-
const runtimeDep = env.VERCEL_RUNTIME_PYTHON || (isLocalDev ? localRuntimeDir : `vercel-runtime==${VERCEL_RUNTIME_VERSION}`);
|
|
6406
|
-
if (!isLocalDev && !env.VERCEL_RUNTIME_PYTHON) {
|
|
6407
|
-
const distInfo = (0, import_path10.join)(
|
|
6408
|
-
targetDir,
|
|
6409
|
-
`vercel_runtime-${VERCEL_RUNTIME_VERSION}.dist-info`
|
|
6410
|
-
);
|
|
6411
|
-
if ((0, import_fs10.existsSync)(distInfo)) {
|
|
6412
|
-
(0, import_build_utils13.debug)(
|
|
6413
|
-
`vercel-runtime ${VERCEL_RUNTIME_VERSION} already installed, skipping`
|
|
6414
|
-
);
|
|
6415
|
-
return;
|
|
6416
|
-
}
|
|
6417
|
-
}
|
|
6418
|
-
(0, import_build_utils13.debug)(
|
|
6419
|
-
`Installing vercel-runtime into ${targetDir} (type: ${isLocalDev ? "local" : "pypi"}, source: ${runtimeDep})`
|
|
6420
|
-
);
|
|
6421
|
-
const pip = uvPath ? { cmd: uvPath, prefix: ["pip", "install"] } : { cmd: pythonBin, prefix: ["-m", "pip", "install"] };
|
|
6422
|
-
const spawnArgs = [...pip.prefix, "--target", targetDir, runtimeDep];
|
|
6423
|
-
await new Promise((resolve3, reject) => {
|
|
6424
|
-
const child = (0, import_child_process2.spawn)(pip.cmd, spawnArgs, {
|
|
6425
|
-
cwd: workPath,
|
|
6426
|
-
env: getProtectedUvEnv(env),
|
|
6427
|
-
stdio: ["inherit", "pipe", "pipe"]
|
|
6428
|
-
});
|
|
6429
|
-
child.stdout?.on("data", (data) => {
|
|
6430
|
-
if (onStdout) {
|
|
6431
|
-
onStdout(data);
|
|
6432
|
-
} else {
|
|
6433
|
-
(0, import_build_utils13.debug)(data.toString());
|
|
6434
|
-
}
|
|
6435
|
-
});
|
|
6436
|
-
child.stderr?.on("data", (data) => {
|
|
6437
|
-
if (onStderr) {
|
|
6438
|
-
onStderr(data);
|
|
6439
|
-
} else {
|
|
6440
|
-
(0, import_build_utils13.debug)(data.toString());
|
|
6441
|
-
}
|
|
6442
|
-
});
|
|
6443
|
-
child.on("error", reject);
|
|
6444
|
-
child.on("exit", (code, signal) => {
|
|
6445
|
-
if (code === 0) {
|
|
6446
|
-
resolve3();
|
|
6447
|
-
} else {
|
|
6448
|
-
reject(
|
|
6449
|
-
new Error(
|
|
6450
|
-
`Installing vercel-runtime failed with code ${code}, signal ${signal}`
|
|
6451
|
-
)
|
|
6452
|
-
);
|
|
6453
|
-
}
|
|
6454
|
-
});
|
|
6455
|
-
});
|
|
6456
|
-
}
|
|
6457
|
-
async function installVercelWorkers({
|
|
6458
|
-
workPath,
|
|
6459
|
-
uvPath,
|
|
6460
|
-
pythonBin,
|
|
6461
|
-
env,
|
|
6462
|
-
onStdout,
|
|
6463
|
-
onStderr
|
|
6464
|
-
}) {
|
|
6465
|
-
const targetDir = (0, import_path10.join)(workPath, ".vercel", "python");
|
|
6466
|
-
let pending = PENDING_WORKERS_INSTALLS.get(targetDir);
|
|
6344
|
+
var PENDING_INSTALLS = /* @__PURE__ */ new Map();
|
|
6345
|
+
async function installInjectedDevPackage(pkg, opts) {
|
|
6346
|
+
const targetDir = (0, import_path10.join)(opts.workPath, ".vercel", "python");
|
|
6347
|
+
const key = `${targetDir}:${pkg.name}`;
|
|
6348
|
+
let pending = PENDING_INSTALLS.get(key);
|
|
6467
6349
|
if (!pending) {
|
|
6468
|
-
pending =
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
uvPath,
|
|
6472
|
-
pythonBin,
|
|
6473
|
-
env,
|
|
6474
|
-
onStdout,
|
|
6475
|
-
onStderr
|
|
6476
|
-
});
|
|
6477
|
-
PENDING_WORKERS_INSTALLS.set(targetDir, pending);
|
|
6478
|
-
pending.finally(() => PENDING_WORKERS_INSTALLS.delete(targetDir));
|
|
6350
|
+
pending = doInstallInjectedDevPackage(pkg, { ...opts, targetDir });
|
|
6351
|
+
PENDING_INSTALLS.set(key, pending);
|
|
6352
|
+
pending.finally(() => PENDING_INSTALLS.delete(key));
|
|
6479
6353
|
}
|
|
6480
6354
|
await pending;
|
|
6481
6355
|
}
|
|
6482
|
-
async function
|
|
6483
|
-
targetDir,
|
|
6484
|
-
workPath,
|
|
6485
|
-
uvPath,
|
|
6486
|
-
pythonBin,
|
|
6487
|
-
env,
|
|
6488
|
-
onStdout,
|
|
6489
|
-
onStderr
|
|
6490
|
-
}) {
|
|
6356
|
+
async function doInstallInjectedDevPackage(pkg, opts) {
|
|
6357
|
+
const { targetDir, workPath, uvPath, pythonBin, env, onStdout, onStderr } = opts;
|
|
6491
6358
|
(0, import_fs10.mkdirSync)(targetDir, { recursive: true });
|
|
6492
|
-
const
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
"
|
|
6497
|
-
"python",
|
|
6498
|
-
"vercel-workers"
|
|
6499
|
-
);
|
|
6500
|
-
const isLocalDev = (0, import_fs10.existsSync)((0, import_path10.join)(localWorkersDir, "pyproject.toml"));
|
|
6501
|
-
const workersDep = env.VERCEL_WORKERS_PYTHON || (isLocalDev ? localWorkersDir : `vercel-workers==${VERCEL_WORKERS_VERSION}`);
|
|
6502
|
-
if (!isLocalDev && !env.VERCEL_WORKERS_PYTHON) {
|
|
6359
|
+
const localDir = (0, import_path10.join)(__dirname, "..", "..", "..", "python", pkg.name);
|
|
6360
|
+
const isLocalDev = (0, import_fs10.existsSync)((0, import_path10.join)(localDir, "pyproject.toml"));
|
|
6361
|
+
const dep = pkg.envOverride || (isLocalDev ? localDir : `${pkg.name}==${pkg.pinnedVersion}`);
|
|
6362
|
+
if (!isLocalDev && !pkg.envOverride) {
|
|
6363
|
+
const distInfoName = pkg.name.replace("-", "_");
|
|
6503
6364
|
const distInfo = (0, import_path10.join)(
|
|
6504
6365
|
targetDir,
|
|
6505
|
-
|
|
6366
|
+
`${distInfoName}-${pkg.pinnedVersion}.dist-info`
|
|
6506
6367
|
);
|
|
6507
6368
|
if ((0, import_fs10.existsSync)(distInfo)) {
|
|
6508
|
-
(0, import_build_utils13.debug)(
|
|
6509
|
-
`vercel-workers ${VERCEL_WORKERS_VERSION} already installed, skipping`
|
|
6510
|
-
);
|
|
6369
|
+
(0, import_build_utils13.debug)(`${pkg.name} ${pkg.pinnedVersion} already installed, skipping`);
|
|
6511
6370
|
return;
|
|
6512
6371
|
}
|
|
6513
6372
|
}
|
|
6514
6373
|
(0, import_build_utils13.debug)(
|
|
6515
|
-
`Installing
|
|
6374
|
+
`Installing ${pkg.name} into ${targetDir} (type: ${isLocalDev ? "local" : "pypi"}, source: ${dep})`
|
|
6516
6375
|
);
|
|
6517
6376
|
const pip = uvPath ? { cmd: uvPath, prefix: ["pip", "install"] } : { cmd: pythonBin, prefix: ["-m", "pip", "install"] };
|
|
6518
|
-
const
|
|
6377
|
+
const excludeOverride = uvPath ? ["--exclude-newer-package", `${pkg.name}=false`] : [];
|
|
6378
|
+
const spawnArgs = [
|
|
6379
|
+
...pip.prefix,
|
|
6380
|
+
"--target",
|
|
6381
|
+
targetDir,
|
|
6382
|
+
...excludeOverride,
|
|
6383
|
+
dep
|
|
6384
|
+
];
|
|
6519
6385
|
await new Promise((resolve3, reject) => {
|
|
6520
6386
|
const child = (0, import_child_process2.spawn)(pip.cmd, spawnArgs, {
|
|
6521
6387
|
cwd: workPath,
|
|
@@ -6543,7 +6409,7 @@ async function doInstallVercelWorkers({
|
|
|
6543
6409
|
} else {
|
|
6544
6410
|
reject(
|
|
6545
6411
|
new Error(
|
|
6546
|
-
`Installing
|
|
6412
|
+
`Installing ${pkg.name} failed with code ${code}, signal ${signal}`
|
|
6547
6413
|
)
|
|
6548
6414
|
);
|
|
6549
6415
|
}
|
|
@@ -6790,6 +6656,14 @@ If you are using a virtual environment, activate it before running "vercel dev",
|
|
|
6790
6656
|
}
|
|
6791
6657
|
}
|
|
6792
6658
|
}
|
|
6659
|
+
const devOpts = {
|
|
6660
|
+
workPath,
|
|
6661
|
+
uvPath,
|
|
6662
|
+
pythonBin: spawnCommand,
|
|
6663
|
+
env,
|
|
6664
|
+
onStdout,
|
|
6665
|
+
onStderr
|
|
6666
|
+
};
|
|
6793
6667
|
if (meta.syncDependencies) {
|
|
6794
6668
|
const gray = "\x1B[90m";
|
|
6795
6669
|
const reset = "\x1B[0m";
|
|
@@ -6800,30 +6674,25 @@ If you are using a virtual environment, activate it before running "vercel dev",
|
|
|
6800
6674
|
} else {
|
|
6801
6675
|
console.log(syncMessage);
|
|
6802
6676
|
}
|
|
6803
|
-
await syncDependencies(
|
|
6804
|
-
workPath,
|
|
6805
|
-
uvPath,
|
|
6806
|
-
pythonBin: spawnCommand,
|
|
6807
|
-
env,
|
|
6808
|
-
onStdout,
|
|
6809
|
-
onStderr
|
|
6810
|
-
});
|
|
6677
|
+
await syncDependencies(devOpts);
|
|
6811
6678
|
}
|
|
6812
|
-
await
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6679
|
+
await installInjectedDevPackage(
|
|
6680
|
+
{
|
|
6681
|
+
name: "vercel-runtime",
|
|
6682
|
+
pinnedVersion: VERCEL_RUNTIME_VERSION,
|
|
6683
|
+
envOverride: env.VERCEL_RUNTIME_PYTHON
|
|
6684
|
+
},
|
|
6685
|
+
devOpts
|
|
6686
|
+
);
|
|
6818
6687
|
if (hasWorkerServicesEnabled(env)) {
|
|
6819
|
-
await
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6688
|
+
await installInjectedDevPackage(
|
|
6689
|
+
{
|
|
6690
|
+
name: "vercel-workers",
|
|
6691
|
+
pinnedVersion: VERCEL_WORKERS_VERSION,
|
|
6692
|
+
envOverride: env.VERCEL_WORKERS_PYTHON
|
|
6693
|
+
},
|
|
6694
|
+
devOpts
|
|
6695
|
+
);
|
|
6827
6696
|
}
|
|
6828
6697
|
const crons = await getServiceCrons({
|
|
6829
6698
|
service,
|
|
@@ -7677,11 +7546,19 @@ async function installInjectedPackage({
|
|
|
7677
7546
|
const localDir = (0, import_path14.join)(__dirname, "..", "..", "..", "python", name);
|
|
7678
7547
|
const isLocalDev = import_fs14.default.existsSync((0, import_path14.join)(localDir, "pyproject.toml"));
|
|
7679
7548
|
const dep = envOverride || (isLocalDev ? localDir : pinned);
|
|
7549
|
+
const noExclude = ["--exclude-newer-package", `${name}=false`];
|
|
7680
7550
|
(0, import_build_utils18.debug)(`Installing ${dep}`);
|
|
7681
7551
|
await uv.pip({
|
|
7682
7552
|
venvPath,
|
|
7683
7553
|
projectDir,
|
|
7684
|
-
args: [
|
|
7554
|
+
args: [
|
|
7555
|
+
"install",
|
|
7556
|
+
"--link-mode",
|
|
7557
|
+
"copy",
|
|
7558
|
+
...pipPlatformArgs,
|
|
7559
|
+
...noExclude,
|
|
7560
|
+
dep
|
|
7561
|
+
]
|
|
7685
7562
|
});
|
|
7686
7563
|
}
|
|
7687
7564
|
var build = async ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/python",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.45.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"smol-toml": "1.5.2",
|
|
35
35
|
"vitest": "2.1.4",
|
|
36
36
|
"which": "3.0.0",
|
|
37
|
-
"@vercel/build-utils": "13.
|
|
37
|
+
"@vercel/build-utils": "13.30.0",
|
|
38
38
|
"@vercel/python-runtime": "0.14.2",
|
|
39
39
|
"@vercel/error-utils": "2.2.0"
|
|
40
40
|
},
|