@vercel/python 6.44.1 → 6.45.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.
- package/dist/index.js +61 -169
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -6356,166 +6356,47 @@ async function runSync({
|
|
|
6356
6356
|
});
|
|
6357
6357
|
});
|
|
6358
6358
|
}
|
|
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);
|
|
6359
|
+
var PENDING_INSTALLS = /* @__PURE__ */ new Map();
|
|
6360
|
+
async function installInjectedDevPackage(pkg, opts) {
|
|
6361
|
+
const targetDir = (0, import_path10.join)(opts.workPath, ".vercel", "python");
|
|
6362
|
+
const key = `${targetDir}:${pkg.name}`;
|
|
6363
|
+
let pending = PENDING_INSTALLS.get(key);
|
|
6371
6364
|
if (!pending) {
|
|
6372
|
-
pending =
|
|
6373
|
-
|
|
6374
|
-
|
|
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));
|
|
6365
|
+
pending = doInstallInjectedDevPackage(pkg, { ...opts, targetDir });
|
|
6366
|
+
PENDING_INSTALLS.set(key, pending);
|
|
6367
|
+
pending.finally(() => PENDING_INSTALLS.delete(key));
|
|
6383
6368
|
}
|
|
6384
6369
|
await pending;
|
|
6385
6370
|
}
|
|
6386
|
-
async function
|
|
6387
|
-
targetDir,
|
|
6388
|
-
workPath,
|
|
6389
|
-
uvPath,
|
|
6390
|
-
pythonBin,
|
|
6391
|
-
env,
|
|
6392
|
-
onStdout,
|
|
6393
|
-
onStderr
|
|
6394
|
-
}) {
|
|
6371
|
+
async function doInstallInjectedDevPackage(pkg, opts) {
|
|
6372
|
+
const { targetDir, workPath, uvPath, pythonBin, env, onStdout, onStderr } = opts;
|
|
6395
6373
|
(0, import_fs10.mkdirSync)(targetDir, { recursive: true });
|
|
6396
|
-
const
|
|
6397
|
-
|
|
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) {
|
|
6374
|
+
const localDir = (0, import_path10.join)(__dirname, "..", "..", "..", "python", pkg.name);
|
|
6375
|
+
const isLocalDev = (0, import_fs10.existsSync)((0, import_path10.join)(localDir, "pyproject.toml"));
|
|
6376
|
+
const dep = pkg.envOverride || (isLocalDev ? localDir : `${pkg.name}==${pkg.pinnedVersion}`);
|
|
6377
|
+
if (!isLocalDev && !pkg.envOverride) {
|
|
6378
|
+
const distInfoName = pkg.name.replace("-", "_");
|
|
6407
6379
|
const distInfo = (0, import_path10.join)(
|
|
6408
6380
|
targetDir,
|
|
6409
|
-
|
|
6381
|
+
`${distInfoName}-${pkg.pinnedVersion}.dist-info`
|
|
6410
6382
|
);
|
|
6411
6383
|
if ((0, import_fs10.existsSync)(distInfo)) {
|
|
6412
|
-
(0, import_build_utils13.debug)(
|
|
6413
|
-
`vercel-runtime ${VERCEL_RUNTIME_VERSION} already installed, skipping`
|
|
6414
|
-
);
|
|
6384
|
+
(0, import_build_utils13.debug)(`${pkg.name} ${pkg.pinnedVersion} already installed, skipping`);
|
|
6415
6385
|
return;
|
|
6416
6386
|
}
|
|
6417
6387
|
}
|
|
6418
6388
|
(0, import_build_utils13.debug)(
|
|
6419
|
-
`Installing
|
|
6389
|
+
`Installing ${pkg.name} into ${targetDir} (type: ${isLocalDev ? "local" : "pypi"}, source: ${dep})`
|
|
6420
6390
|
);
|
|
6421
6391
|
const pip = uvPath ? { cmd: uvPath, prefix: ["pip", "install"] } : { cmd: pythonBin, prefix: ["-m", "pip", "install"] };
|
|
6422
|
-
const
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
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);
|
|
6467
|
-
if (!pending) {
|
|
6468
|
-
pending = doInstallVercelWorkers({
|
|
6469
|
-
targetDir,
|
|
6470
|
-
workPath,
|
|
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));
|
|
6479
|
-
}
|
|
6480
|
-
await pending;
|
|
6481
|
-
}
|
|
6482
|
-
async function doInstallVercelWorkers({
|
|
6483
|
-
targetDir,
|
|
6484
|
-
workPath,
|
|
6485
|
-
uvPath,
|
|
6486
|
-
pythonBin,
|
|
6487
|
-
env,
|
|
6488
|
-
onStdout,
|
|
6489
|
-
onStderr
|
|
6490
|
-
}) {
|
|
6491
|
-
(0, import_fs10.mkdirSync)(targetDir, { recursive: true });
|
|
6492
|
-
const localWorkersDir = (0, import_path10.join)(
|
|
6493
|
-
__dirname,
|
|
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) {
|
|
6503
|
-
const distInfo = (0, import_path10.join)(
|
|
6504
|
-
targetDir,
|
|
6505
|
-
`vercel_workers-${VERCEL_WORKERS_VERSION}.dist-info`
|
|
6506
|
-
);
|
|
6507
|
-
if ((0, import_fs10.existsSync)(distInfo)) {
|
|
6508
|
-
(0, import_build_utils13.debug)(
|
|
6509
|
-
`vercel-workers ${VERCEL_WORKERS_VERSION} already installed, skipping`
|
|
6510
|
-
);
|
|
6511
|
-
return;
|
|
6512
|
-
}
|
|
6513
|
-
}
|
|
6514
|
-
(0, import_build_utils13.debug)(
|
|
6515
|
-
`Installing vercel-workers into ${targetDir} (type: ${isLocalDev ? "local" : "pypi"}, source: ${workersDep})`
|
|
6516
|
-
);
|
|
6517
|
-
const pip = uvPath ? { cmd: uvPath, prefix: ["pip", "install"] } : { cmd: pythonBin, prefix: ["-m", "pip", "install"] };
|
|
6518
|
-
const spawnArgs = [...pip.prefix, "--target", targetDir, workersDep];
|
|
6392
|
+
const excludeOverride = uvPath ? ["--exclude-newer-package", `${pkg.name}=false`] : [];
|
|
6393
|
+
const spawnArgs = [
|
|
6394
|
+
...pip.prefix,
|
|
6395
|
+
"--target",
|
|
6396
|
+
targetDir,
|
|
6397
|
+
...excludeOverride,
|
|
6398
|
+
dep
|
|
6399
|
+
];
|
|
6519
6400
|
await new Promise((resolve3, reject) => {
|
|
6520
6401
|
const child = (0, import_child_process2.spawn)(pip.cmd, spawnArgs, {
|
|
6521
6402
|
cwd: workPath,
|
|
@@ -6543,7 +6424,7 @@ async function doInstallVercelWorkers({
|
|
|
6543
6424
|
} else {
|
|
6544
6425
|
reject(
|
|
6545
6426
|
new Error(
|
|
6546
|
-
`Installing
|
|
6427
|
+
`Installing ${pkg.name} failed with code ${code}, signal ${signal}`
|
|
6547
6428
|
)
|
|
6548
6429
|
);
|
|
6549
6430
|
}
|
|
@@ -6790,6 +6671,14 @@ If you are using a virtual environment, activate it before running "vercel dev",
|
|
|
6790
6671
|
}
|
|
6791
6672
|
}
|
|
6792
6673
|
}
|
|
6674
|
+
const devOpts = {
|
|
6675
|
+
workPath,
|
|
6676
|
+
uvPath,
|
|
6677
|
+
pythonBin: spawnCommand,
|
|
6678
|
+
env,
|
|
6679
|
+
onStdout,
|
|
6680
|
+
onStderr
|
|
6681
|
+
};
|
|
6793
6682
|
if (meta.syncDependencies) {
|
|
6794
6683
|
const gray = "\x1B[90m";
|
|
6795
6684
|
const reset = "\x1B[0m";
|
|
@@ -6800,30 +6689,25 @@ If you are using a virtual environment, activate it before running "vercel dev",
|
|
|
6800
6689
|
} else {
|
|
6801
6690
|
console.log(syncMessage);
|
|
6802
6691
|
}
|
|
6803
|
-
await syncDependencies(
|
|
6804
|
-
workPath,
|
|
6805
|
-
uvPath,
|
|
6806
|
-
pythonBin: spawnCommand,
|
|
6807
|
-
env,
|
|
6808
|
-
onStdout,
|
|
6809
|
-
onStderr
|
|
6810
|
-
});
|
|
6692
|
+
await syncDependencies(devOpts);
|
|
6811
6693
|
}
|
|
6812
|
-
await
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6694
|
+
await installInjectedDevPackage(
|
|
6695
|
+
{
|
|
6696
|
+
name: "vercel-runtime",
|
|
6697
|
+
pinnedVersion: VERCEL_RUNTIME_VERSION,
|
|
6698
|
+
envOverride: env.VERCEL_RUNTIME_PYTHON
|
|
6699
|
+
},
|
|
6700
|
+
devOpts
|
|
6701
|
+
);
|
|
6818
6702
|
if (hasWorkerServicesEnabled(env)) {
|
|
6819
|
-
await
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6703
|
+
await installInjectedDevPackage(
|
|
6704
|
+
{
|
|
6705
|
+
name: "vercel-workers",
|
|
6706
|
+
pinnedVersion: VERCEL_WORKERS_VERSION,
|
|
6707
|
+
envOverride: env.VERCEL_WORKERS_PYTHON
|
|
6708
|
+
},
|
|
6709
|
+
devOpts
|
|
6710
|
+
);
|
|
6827
6711
|
}
|
|
6828
6712
|
const crons = await getServiceCrons({
|
|
6829
6713
|
service,
|
|
@@ -7677,11 +7561,19 @@ async function installInjectedPackage({
|
|
|
7677
7561
|
const localDir = (0, import_path14.join)(__dirname, "..", "..", "..", "python", name);
|
|
7678
7562
|
const isLocalDev = import_fs14.default.existsSync((0, import_path14.join)(localDir, "pyproject.toml"));
|
|
7679
7563
|
const dep = envOverride || (isLocalDev ? localDir : pinned);
|
|
7564
|
+
const noExclude = ["--exclude-newer-package", `${name}=false`];
|
|
7680
7565
|
(0, import_build_utils18.debug)(`Installing ${dep}`);
|
|
7681
7566
|
await uv.pip({
|
|
7682
7567
|
venvPath,
|
|
7683
7568
|
projectDir,
|
|
7684
|
-
args: [
|
|
7569
|
+
args: [
|
|
7570
|
+
"install",
|
|
7571
|
+
"--link-mode",
|
|
7572
|
+
"copy",
|
|
7573
|
+
...pipPlatformArgs,
|
|
7574
|
+
...noExclude,
|
|
7575
|
+
dep
|
|
7576
|
+
]
|
|
7685
7577
|
});
|
|
7686
7578
|
}
|
|
7687
7579
|
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.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"smol-toml": "1.5.2",
|
|
35
35
|
"vitest": "2.1.4",
|
|
36
36
|
"which": "3.0.0",
|
|
37
|
-
"@vercel/build-utils": "13.
|
|
38
|
-
"@vercel/
|
|
39
|
-
"@vercel/
|
|
37
|
+
"@vercel/build-utils": "13.30.0",
|
|
38
|
+
"@vercel/error-utils": "2.2.0",
|
|
39
|
+
"@vercel/python-runtime": "0.14.2"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "node ../../utils/build-builder.mjs",
|