@vercel/python 6.35.0 → 6.36.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 +41 -23
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3745,6 +3745,8 @@ var import_fs3 = require("fs");
|
|
|
3745
3745
|
var import_build_utils3 = require("@vercel/build-utils");
|
|
3746
3746
|
var import_python_analysis = require("@vercel/python-analysis");
|
|
3747
3747
|
function pythonVersionString(pv) {
|
|
3748
|
+
if (pv.major === void 0 || pv.minor === void 0)
|
|
3749
|
+
return void 0;
|
|
3748
3750
|
return `${pv.major}.${pv.minor}`;
|
|
3749
3751
|
}
|
|
3750
3752
|
var DEFAULT_PYTHON_VERSION = makePythonVersion(3, 12);
|
|
@@ -3772,8 +3774,6 @@ var allOptions = [
|
|
|
3772
3774
|
];
|
|
3773
3775
|
function getDevPythonVersion() {
|
|
3774
3776
|
return {
|
|
3775
|
-
major: 3,
|
|
3776
|
-
minor: 0,
|
|
3777
3777
|
pipPath: "pip3",
|
|
3778
3778
|
pythonPath: "python3",
|
|
3779
3779
|
runtime: "python3"
|
|
@@ -3805,11 +3805,18 @@ function versionsEqual(a, b) {
|
|
|
3805
3805
|
return a.major === b.major && a.minor === b.minor;
|
|
3806
3806
|
}
|
|
3807
3807
|
function versionLessOrEqual(a, b) {
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3808
|
+
const am = a.major ?? 0;
|
|
3809
|
+
const bm = b.major ?? 0;
|
|
3810
|
+
if (am !== bm)
|
|
3811
|
+
return am < bm;
|
|
3812
|
+
return (a.minor ?? 0) <= (b.minor ?? 0);
|
|
3811
3813
|
}
|
|
3812
3814
|
function toPythonBuild(opt) {
|
|
3815
|
+
if (opt.major === void 0 || opt.minor === void 0) {
|
|
3816
|
+
throw new Error(
|
|
3817
|
+
"toPythonBuild called with PythonVersion missing `major`/`minor`; this is a bug."
|
|
3818
|
+
);
|
|
3819
|
+
}
|
|
3813
3820
|
const platform = detectPlatform();
|
|
3814
3821
|
return {
|
|
3815
3822
|
version: { major: opt.major, minor: opt.minor },
|
|
@@ -3948,9 +3955,12 @@ var installedPythonsCache = null;
|
|
|
3948
3955
|
function getInstalledPythonsFromFilesystem(basePath = UV_PYTHON_PATH_PREFIX) {
|
|
3949
3956
|
const result = /* @__PURE__ */ new Set();
|
|
3950
3957
|
for (const opt of allOptions) {
|
|
3951
|
-
const
|
|
3958
|
+
const version2 = pythonVersionString(opt);
|
|
3959
|
+
if (!version2)
|
|
3960
|
+
continue;
|
|
3961
|
+
const binPath = (0, import_path4.join)(basePath, "bin", `python${version2}`);
|
|
3952
3962
|
if ((0, import_fs3.existsSync)(binPath)) {
|
|
3953
|
-
result.add(
|
|
3963
|
+
result.add(version2);
|
|
3954
3964
|
}
|
|
3955
3965
|
}
|
|
3956
3966
|
return result;
|
|
@@ -3978,7 +3988,10 @@ function getInstalledPythons() {
|
|
|
3978
3988
|
function isInstalled(pv) {
|
|
3979
3989
|
try {
|
|
3980
3990
|
const installed = getInstalledPythons();
|
|
3981
|
-
|
|
3991
|
+
const version2 = pythonVersionString(pv);
|
|
3992
|
+
if (!version2)
|
|
3993
|
+
return false;
|
|
3994
|
+
return installed.has(version2);
|
|
3982
3995
|
} catch (err) {
|
|
3983
3996
|
throw new import_build_utils3.NowBuildError({
|
|
3984
3997
|
code: "UV_ERROR",
|
|
@@ -4164,7 +4177,7 @@ async function ensureUvProject({
|
|
|
4164
4177
|
console.log("Installing required dependencies from pyproject.toml...");
|
|
4165
4178
|
}
|
|
4166
4179
|
if (manifest.origin) {
|
|
4167
|
-
if (manifest.data.project) {
|
|
4180
|
+
if (manifest.data.project && pythonVersion !== void 0) {
|
|
4168
4181
|
manifest.data.project["requires-python"] = `~=${pythonVersion}.0`;
|
|
4169
4182
|
}
|
|
4170
4183
|
const content = (0, import_python_analysis2.stringifyManifest)(manifest.data);
|
|
@@ -4189,7 +4202,7 @@ async function ensureUvProject({
|
|
|
4189
4202
|
console.log(
|
|
4190
4203
|
"No Python manifest found; creating an empty pyproject.toml and uv.lock..."
|
|
4191
4204
|
);
|
|
4192
|
-
const requiresPython = `~=${pythonVersion}.0`;
|
|
4205
|
+
const requiresPython = pythonVersion !== void 0 ? `~=${pythonVersion}.0` : `>=${DEFAULT_PYTHON_VERSION_STRING}`;
|
|
4193
4206
|
const minimalManifest = (0, import_python_analysis2.createMinimalManifest)({
|
|
4194
4207
|
name: "app",
|
|
4195
4208
|
requiresPython,
|
|
@@ -4641,6 +4654,10 @@ To fix this, either:
|
|
|
4641
4654
|
*/
|
|
4642
4655
|
async findPackagesWithoutCompatibleWheels(lockFile, publicPackageNames) {
|
|
4643
4656
|
const platform = detectPlatform();
|
|
4657
|
+
if (this.pythonMajor === void 0 || this.pythonMinor === void 0) {
|
|
4658
|
+
(0, import_build_utils5.debug)("Skipping wheel compatibility check: dev mode");
|
|
4659
|
+
return [];
|
|
4660
|
+
}
|
|
4644
4661
|
const reachable = await getPackagesReachableOnPlatform(
|
|
4645
4662
|
lockFile,
|
|
4646
4663
|
this.projectName,
|
|
@@ -4925,9 +4942,10 @@ async function generateProjectManifest({
|
|
|
4925
4942
|
workPath,
|
|
4926
4943
|
pythonPackage,
|
|
4927
4944
|
pythonVersion,
|
|
4928
|
-
uvLockPath
|
|
4945
|
+
uvLockPath,
|
|
4946
|
+
framework
|
|
4929
4947
|
}) {
|
|
4930
|
-
const resolved = pythonVersionString(pythonVersion);
|
|
4948
|
+
const resolved = pythonVersionString(pythonVersion) ?? "";
|
|
4931
4949
|
const constraint = pythonPackage.requiresPython?.[0];
|
|
4932
4950
|
const requested = constraint?.specifier;
|
|
4933
4951
|
const project = pythonPackage.manifest?.data?.project;
|
|
@@ -5078,6 +5096,7 @@ async function generateProjectManifest({
|
|
|
5078
5096
|
const manifest = {
|
|
5079
5097
|
version: import_build_utils6.MANIFEST_VERSION,
|
|
5080
5098
|
runtime: "python",
|
|
5099
|
+
...framework ? { framework } : {},
|
|
5081
5100
|
runtimeVersion: {
|
|
5082
5101
|
...requested ? { requested } : {},
|
|
5083
5102
|
...constraint?.source ? { requestedSource: constraint.source } : {},
|
|
@@ -6921,20 +6940,18 @@ var build = async ({
|
|
|
6921
6940
|
rootDir
|
|
6922
6941
|
});
|
|
6923
6942
|
versionSpan.setAttributes({
|
|
6924
|
-
"python.version": pythonVersionString(resolution.pythonVersion),
|
|
6943
|
+
"python.version": pythonVersionString(resolution.pythonVersion) ?? "unknown",
|
|
6925
6944
|
"python.versionSource": resolution.versionSource
|
|
6926
6945
|
});
|
|
6927
6946
|
return resolution;
|
|
6928
6947
|
});
|
|
6929
6948
|
if (pinVersionFilePath) {
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
`
|
|
6937
|
-
);
|
|
6949
|
+
const versionToPin = pythonVersionString(pythonVersion);
|
|
6950
|
+
if (versionToPin) {
|
|
6951
|
+
console.log(`Writing .python-version file with version ${versionToPin}`);
|
|
6952
|
+
await writeFile(pinVersionFilePath, `${versionToPin}
|
|
6953
|
+
`);
|
|
6954
|
+
}
|
|
6938
6955
|
}
|
|
6939
6956
|
const uvCacheDir = getUvCacheDir(workPath);
|
|
6940
6957
|
let uv;
|
|
@@ -7274,13 +7291,14 @@ from vercel_runtime.vc_init import vc_handler
|
|
|
7274
7291
|
environment: lambdaEnv,
|
|
7275
7292
|
supportsResponseStreaming: true
|
|
7276
7293
|
});
|
|
7277
|
-
if (uvLockPath) {
|
|
7294
|
+
if (uvLockPath && !meta.isDev) {
|
|
7278
7295
|
try {
|
|
7279
7296
|
await generateProjectManifest({
|
|
7280
7297
|
workPath,
|
|
7281
7298
|
pythonPackage,
|
|
7282
7299
|
pythonVersion,
|
|
7283
|
-
uvLockPath
|
|
7300
|
+
uvLockPath,
|
|
7301
|
+
framework
|
|
7284
7302
|
});
|
|
7285
7303
|
} catch (err) {
|
|
7286
7304
|
(0, import_build_utils16.debug)(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/python",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.36.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"smol-toml": "1.5.2",
|
|
37
37
|
"vitest": "2.1.4",
|
|
38
38
|
"which": "3.0.0",
|
|
39
|
+
"@vercel/build-utils": "13.20.0",
|
|
39
40
|
"@vercel/python-runtime": "0.13.0",
|
|
40
|
-
"@vercel/error-utils": "2.0.3"
|
|
41
|
-
"@vercel/build-utils": "13.19.0"
|
|
41
|
+
"@vercel/error-utils": "2.0.3"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "node ../../utils/build-builder.mjs",
|