@vercel/python 6.56.0 → 6.56.2
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 +74 -2
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -5032,7 +5032,7 @@ var import_fs20 = __toESM(require("fs"));
|
|
|
5032
5032
|
var import_path21 = require("path");
|
|
5033
5033
|
|
|
5034
5034
|
// src/package-versions.ts
|
|
5035
|
-
var VERCEL_RUNTIME_VERSION = "0.
|
|
5035
|
+
var VERCEL_RUNTIME_VERSION = "0.20.0";
|
|
5036
5036
|
var VERCEL_WORKERS_VERSION = "0.0.25";
|
|
5037
5037
|
|
|
5038
5038
|
// src/conditional-vendoring.ts
|
|
@@ -5170,6 +5170,30 @@ async function hasExplicitVercelSdkDependency(pythonPackage) {
|
|
|
5170
5170
|
);
|
|
5171
5171
|
return names?.has("vercel") ?? false;
|
|
5172
5172
|
}
|
|
5173
|
+
async function getLocalSdkSourcePaths({
|
|
5174
|
+
pythonPackage,
|
|
5175
|
+
env
|
|
5176
|
+
}) {
|
|
5177
|
+
const sdkRoot = env.VERCEL_SDK_PYTHON;
|
|
5178
|
+
if (!sdkRoot) {
|
|
5179
|
+
return [];
|
|
5180
|
+
}
|
|
5181
|
+
const names = await getDeclaredDependencyNames(
|
|
5182
|
+
pythonPackage?.manifest?.data?.project?.dependencies
|
|
5183
|
+
);
|
|
5184
|
+
const hasVercelPackage = [...names ?? []].some(
|
|
5185
|
+
(name) => name === "vercel" || name.startsWith("vercel-")
|
|
5186
|
+
);
|
|
5187
|
+
if (!hasVercelPackage) {
|
|
5188
|
+
return [];
|
|
5189
|
+
}
|
|
5190
|
+
const entries = await import_fs.default.promises.readdir((0, import_path.join)(sdkRoot, "src"), {
|
|
5191
|
+
withFileTypes: true
|
|
5192
|
+
});
|
|
5193
|
+
return entries.filter(
|
|
5194
|
+
(entry) => entry.isDirectory() && (entry.name === "vercel" || entry.name.startsWith("vercel-")) && (names?.has("vercel") || names?.has(entry.name))
|
|
5195
|
+
).map((entry) => entry.name).sort().map((name) => (0, import_path.join)(sdkRoot, "src", name));
|
|
5196
|
+
}
|
|
5173
5197
|
async function getInstalledVercelSdkVersion({
|
|
5174
5198
|
uv,
|
|
5175
5199
|
venvPath,
|
|
@@ -6915,12 +6939,24 @@ functions.`,
|
|
|
6915
6939
|
action: "Learn More"
|
|
6916
6940
|
});
|
|
6917
6941
|
}
|
|
6942
|
+
const toolingFiles = {};
|
|
6943
|
+
for (const key of [
|
|
6944
|
+
`${UV_BUNDLE_DIR}/uv`,
|
|
6945
|
+
`${UV_BUNDLE_DIR}/_runtime_config.json`,
|
|
6946
|
+
`${UV_BUNDLE_DIR}/pyproject.toml`,
|
|
6947
|
+
`${UV_BUNDLE_DIR}/uv.lock`
|
|
6948
|
+
]) {
|
|
6949
|
+
if (files[key])
|
|
6950
|
+
toolingFiles[key] = files[key];
|
|
6951
|
+
}
|
|
6952
|
+
const runtimeToolingBytes = await calculateBundleSize(toolingFiles);
|
|
6918
6953
|
return {
|
|
6919
6954
|
fellBackToFullBundle: false,
|
|
6920
6955
|
packingMode,
|
|
6921
6956
|
alwaysBundledPackages: alwaysBundled,
|
|
6922
6957
|
bundledPublicPackages: bundledPublic,
|
|
6923
|
-
externalizedPublicPackages: externalizedPublic
|
|
6958
|
+
externalizedPublicPackages: externalizedPublic,
|
|
6959
|
+
runtimeToolingBytes
|
|
6924
6960
|
};
|
|
6925
6961
|
}
|
|
6926
6962
|
/**
|
|
@@ -11208,10 +11244,15 @@ import os
|
|
|
11208
11244
|
import os.path
|
|
11209
11245
|
import site
|
|
11210
11246
|
import sys
|
|
11247
|
+
import time
|
|
11248
|
+
|
|
11249
|
+
# Cold start baseline, read back by vercel_runtime.vc_init
|
|
11250
|
+
_vc_boot_start_ms = int(time.monotonic() * 1000)
|
|
11211
11251
|
|
|
11212
11252
|
_here = os.path.dirname(__file__)
|
|
11213
11253
|
|
|
11214
11254
|
os.environ.update({
|
|
11255
|
+
"__VC_PY_BOOT_START_MS": str(_vc_boot_start_ms),
|
|
11215
11256
|
"__VC_HANDLER_MODULE_NAME": "${moduleName}",
|
|
11216
11257
|
"__VC_HANDLER_ENTRYPOINT": "${entrypoint}",
|
|
11217
11258
|
"__VC_HANDLER_ENTRYPOINT_ABS": os.path.join(_here, "${entrypoint}"),
|
|
@@ -11652,6 +11693,32 @@ var build = async ({
|
|
|
11652
11693
|
pipPlatformArgs
|
|
11653
11694
|
});
|
|
11654
11695
|
}
|
|
11696
|
+
const localSdkSourcePaths = await getLocalSdkSourcePaths({
|
|
11697
|
+
pythonPackage,
|
|
11698
|
+
env: baseEnv
|
|
11699
|
+
});
|
|
11700
|
+
if (localSdkSourcePaths.length > 0) {
|
|
11701
|
+
(0, import_build_utils24.debug)(
|
|
11702
|
+
`Installing vercel SDK override from ${baseEnv.VERCEL_SDK_PYTHON}: ` + localSdkSourcePaths.join(", ")
|
|
11703
|
+
);
|
|
11704
|
+
await uv.pip({
|
|
11705
|
+
venvPath,
|
|
11706
|
+
projectDir: (0, import_path21.join)(workPath, entryDirectory),
|
|
11707
|
+
args: [
|
|
11708
|
+
"install",
|
|
11709
|
+
"--link-mode",
|
|
11710
|
+
"copy",
|
|
11711
|
+
// Without --no-sources, uv resolves the checkout's workspace
|
|
11712
|
+
// dependencies as editable .pth installs pointing at the (build
|
|
11713
|
+
// only) checkout mount — invisible to bundling and dangling at
|
|
11714
|
+
// runtime. Explicit paths stay real installs; the remaining
|
|
11715
|
+
// workspace siblings resolve from PyPI.
|
|
11716
|
+
"--no-sources",
|
|
11717
|
+
...pipPlatformArgs,
|
|
11718
|
+
...localSdkSourcePaths
|
|
11719
|
+
]
|
|
11720
|
+
});
|
|
11721
|
+
}
|
|
11655
11722
|
if (workflows.length > 0) {
|
|
11656
11723
|
workflowMode = await resolveWorkflowServingMode({
|
|
11657
11724
|
pythonPackage,
|
|
@@ -12127,12 +12194,14 @@ var build = async ({
|
|
|
12127
12194
|
`Function "${entrypoint ?? rawEntrypoint}" exceeds the standard size limit; enabling large functions (beta).`
|
|
12128
12195
|
);
|
|
12129
12196
|
let packingMode;
|
|
12197
|
+
let runtimeToolingBytes = 0;
|
|
12130
12198
|
if (depAnalysis.runtimeInstallEnabled) {
|
|
12131
12199
|
packingMode = "runtime-install";
|
|
12132
12200
|
const bytecodeFirst = compileAllEnabled && pythonVersion.major != null && pythonVersion.minor != null;
|
|
12133
12201
|
const bundleResult = await depExternalizer.generateBundle(files, {
|
|
12134
12202
|
bytecodeFirst
|
|
12135
12203
|
});
|
|
12204
|
+
runtimeToolingBytes = bundleResult.runtimeToolingBytes ?? 0;
|
|
12136
12205
|
if (bundleResult.fellBackToFullBundle) {
|
|
12137
12206
|
packingMode = "hive";
|
|
12138
12207
|
announceLargeFunction();
|
|
@@ -12181,6 +12250,9 @@ var build = async ({
|
|
|
12181
12250
|
}
|
|
12182
12251
|
bundleSpan.setAttributes({
|
|
12183
12252
|
"python.bundle.totalSizeBytes": String(
|
|
12253
|
+
depAnalysis.totalBundleSize + runtimeToolingBytes
|
|
12254
|
+
),
|
|
12255
|
+
"python.bundle.shippedSizeBytes": String(
|
|
12184
12256
|
await calculateBundleSize(files)
|
|
12185
12257
|
),
|
|
12186
12258
|
"python.bundle.packingMode": packingMode
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/python",
|
|
3
|
-
"version": "6.56.
|
|
3
|
+
"version": "6.56.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"directory": "packages/python"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@vercel/python-analysis": "0.13.
|
|
17
|
+
"@vercel/python-analysis": "0.13.2"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@renovatebot/pep440": "4.2.1",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"pip-requirements-js": "1.0.2",
|
|
34
34
|
"semver": "6.3.1",
|
|
35
35
|
"smol-toml": "1.5.2",
|
|
36
|
-
"vitest": "
|
|
36
|
+
"vitest": "4.1.10",
|
|
37
37
|
"which": "3.0.0",
|
|
38
|
-
"@vercel/build-utils": "14.0.3",
|
|
39
38
|
"@vercel/error-utils": "2.2.1",
|
|
40
|
-
"@vercel/python-runtime": "0.
|
|
39
|
+
"@vercel/python-runtime": "0.20.0",
|
|
40
|
+
"@vercel/build-utils": "14.0.5"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "node ../../utils/build-builder.mjs",
|