@vercel/python 6.1.5 → 6.2.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 CHANGED
@@ -2790,8 +2790,19 @@ function useVirtualEnv(workPath, env, systemPython) {
2790
2790
  }
2791
2791
  return { pythonCmd };
2792
2792
  }
2793
+ function getProtectedUvEnv(baseEnv = process.env) {
2794
+ return {
2795
+ ...baseEnv,
2796
+ // Prevent uv from downloading Python interpreters at build time.
2797
+ // The build environment must use the pre-installed system Python.
2798
+ UV_PYTHON_DOWNLOADS: "never"
2799
+ };
2800
+ }
2793
2801
  function createVenvEnv(venvPath, baseEnv = process.env) {
2794
- const env = { ...baseEnv, VIRTUAL_ENV: venvPath };
2802
+ const env = {
2803
+ ...getProtectedUvEnv(baseEnv),
2804
+ VIRTUAL_ENV: venvPath
2805
+ };
2795
2806
  const binDir = getVenvBinDir(venvPath);
2796
2807
  const existingPath = env.PATH || process.env.PATH || "";
2797
2808
  env.PATH = existingPath ? `${binDir}${import_path.delimiter}${existingPath}` : binDir;
@@ -3079,7 +3090,7 @@ async function uvLock({
3079
3090
  const pretty = `${uvPath} ${args.join(" ")}`;
3080
3091
  (0, import_build_utils2.debug)(`Running "${pretty}" in ${projectDir}...`);
3081
3092
  try {
3082
- await (0, import_execa2.default)(uvPath, args, { cwd: projectDir });
3093
+ await (0, import_execa2.default)(uvPath, args, { cwd: projectDir, env: getProtectedUvEnv() });
3083
3094
  } catch (err) {
3084
3095
  throw new Error(
3085
3096
  `Failed to run "${pretty}": ${err instanceof Error ? err.message : String(err)}`
@@ -3318,7 +3329,8 @@ async function pipInstall(pipPath, uvPath, workPath, args, targetDir) {
3318
3329
  (0, import_build_utils2.debug)(`Running "${prettyUv}"...`);
3319
3330
  try {
3320
3331
  await (0, import_execa2.default)(uvPath, uvArgs, {
3321
- cwd: workPath
3332
+ cwd: workPath,
3333
+ env: getProtectedUvEnv()
3322
3334
  });
3323
3335
  return;
3324
3336
  } catch (err) {
@@ -3543,7 +3555,20 @@ var import_build_utils8 = require("@vercel/build-utils");
3543
3555
  // src/version.ts
3544
3556
  var import_build_utils3 = require("@vercel/build-utils");
3545
3557
  var import_which2 = __toESM(require_lib());
3558
+ var DEFAULT_PYTHON_VERSION = "3.12";
3546
3559
  var allOptions = [
3560
+ {
3561
+ version: "3.14",
3562
+ pipPath: "pip3.14",
3563
+ pythonPath: "python3.14",
3564
+ runtime: "python3.14"
3565
+ },
3566
+ {
3567
+ version: "3.13",
3568
+ pipPath: "pip3.13",
3569
+ pythonPath: "python3.13",
3570
+ runtime: "python3.13"
3571
+ },
3547
3572
  {
3548
3573
  version: "3.12",
3549
3574
  pipPath: "pip3.12",
@@ -3590,11 +3615,17 @@ function getLatestPythonVersion({
3590
3615
  if (isDev) {
3591
3616
  return getDevPythonVersion();
3592
3617
  }
3618
+ const defaultOption = allOptions.find(
3619
+ (opt) => opt.version === DEFAULT_PYTHON_VERSION
3620
+ );
3621
+ if (defaultOption && isInstalled2(defaultOption)) {
3622
+ return defaultOption;
3623
+ }
3593
3624
  const selection = allOptions.find(isInstalled2);
3594
3625
  if (!selection) {
3595
3626
  throw new import_build_utils3.NowBuildError({
3596
3627
  code: "PYTHON_NOT_FOUND",
3597
- link: "http://vercel.link/python-version",
3628
+ link: "https://vercel.link/python-version",
3598
3629
  message: `Unable to find any supported Python versions.`
3599
3630
  });
3600
3631
  }
@@ -3695,7 +3726,7 @@ function getSupportedPythonVersion({
3695
3726
  if (isDiscontinued(requested)) {
3696
3727
  throw new import_build_utils3.NowBuildError({
3697
3728
  code: "BUILD_UTILS_PYTHON_VERSION_DISCONTINUED",
3698
- link: "http://vercel.link/python-version",
3729
+ link: "https://vercel.link/python-version",
3699
3730
  message: `Python version "${requested.version}" detected in ${source} is discontinued and must be upgraded.`
3700
3731
  });
3701
3732
  }
@@ -3704,7 +3735,7 @@ function getSupportedPythonVersion({
3704
3735
  console.log(`Using Python ${selection.version} from ${source}`);
3705
3736
  } else {
3706
3737
  console.warn(
3707
- `Warning: Python version "${version2}" detected in ${source} is not installed and will be ignored. http://vercel.link/python-version`
3738
+ `Warning: Python version "${version2}" detected in ${source} is not installed and will be ignored. https://vercel.link/python-version`
3708
3739
  );
3709
3740
  console.log(
3710
3741
  `Falling back to latest installed version: ${selection.version}`
@@ -3712,7 +3743,7 @@ function getSupportedPythonVersion({
3712
3743
  }
3713
3744
  } else {
3714
3745
  console.warn(
3715
- `Warning: Python version "${version2}" detected in ${source} is invalid and will be ignored. http://vercel.link/python-version`
3746
+ `Warning: Python version "${version2}" detected in ${source} is invalid and will be ignored. https://vercel.link/python-version`
3716
3747
  );
3717
3748
  console.log(
3718
3749
  `Falling back to latest installed version: ${selection.version}`
@@ -3726,7 +3757,7 @@ function getSupportedPythonVersion({
3726
3757
  if (isDiscontinued(selection)) {
3727
3758
  throw new import_build_utils3.NowBuildError({
3728
3759
  code: "BUILD_UTILS_PYTHON_VERSION_DISCONTINUED",
3729
- link: "http://vercel.link/python-version",
3760
+ link: "https://vercel.link/python-version",
3730
3761
  message: `Python version "${selection.version}" declared in project configuration is discontinued and must be upgraded.`
3731
3762
  });
3732
3763
  }
@@ -3734,7 +3765,7 @@ function getSupportedPythonVersion({
3734
3765
  const d = selection.discontinueDate.toISOString().split("T")[0];
3735
3766
  const srcSuffix = declaredPythonVersion ? `detected in ${declaredPythonVersion.source}` : "selected by runtime";
3736
3767
  console.warn(
3737
- `Error: Python version "${selection.version}" ${srcSuffix} has reached End-of-Life. Deployments created on or after ${d} will fail to build. http://vercel.link/python-version`
3768
+ `Error: Python version "${selection.version}" ${srcSuffix} has reached End-of-Life. Deployments created on or after ${d} will fail to build. https://vercel.link/python-version`
3738
3769
  );
3739
3770
  }
3740
3771
  return selection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/python",
3
- "version": "6.1.5",
3
+ "version": "6.2.0",
4
4
  "main": "./dist/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
@@ -16,6 +16,7 @@
16
16
  "directory": "packages/python"
17
17
  },
18
18
  "devDependencies": {
19
+ "@renovatebot/pep440": "4.2.1",
19
20
  "@types/execa": "^0.9.0",
20
21
  "@types/fs-extra": "11.0.2",
21
22
  "@types/jest": "27.4.1",
@@ -25,8 +26,12 @@
25
26
  "execa": "^1.0.0",
26
27
  "fs-extra": "11.1.1",
27
28
  "jest-junit": "16.0.0",
29
+ "minimatch": "10.1.1",
30
+ "pip-requirements-js": "1.0.2",
31
+ "smol-toml": "1.5.2",
28
32
  "which": "3.0.0",
29
- "@vercel/build-utils": "13.2.4"
33
+ "@vercel/build-utils": "13.2.12",
34
+ "@vercel/error-utils": "2.0.3"
30
35
  },
31
36
  "scripts": {
32
37
  "build": "node ../../utils/build-builder.mjs",
package/vc_init.py CHANGED
@@ -825,7 +825,18 @@ elif 'app' in __vc_variables:
825
825
  )
826
826
 
827
827
  status_code = message['status']
828
- headers = Headers(message.get('headers', []))
828
+ raw_headers = message.get('headers', [])
829
+
830
+ # Headers from werkzeug transform bytes header value
831
+ # from b'value' to "b'value'" so we need to process
832
+ # ASGI headers manually
833
+ decoded_headers = []
834
+ for key, value in raw_headers:
835
+ decoded_key = key.decode() if isinstance(key, bytes) else key
836
+ decoded_value = value.decode() if isinstance(value, bytes) else value
837
+ decoded_headers.append((decoded_key, decoded_value))
838
+
839
+ headers = Headers(decoded_headers)
829
840
 
830
841
  self.on_request(headers, status_code)
831
842
  self.state = ASGICycleState.RESPONSE