@vercel/python 13.0.2 → 13.0.4

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.
Files changed (2) hide show
  1. package/dist/index.js +16 -3
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -5086,6 +5086,7 @@ var UPSTREAM_DEPENDENCY_ADAPTERS = /* @__PURE__ */ new Map([
5086
5086
  }
5087
5087
  ]
5088
5088
  ]);
5089
+ var QUEUE_ADAPTER_SHARED_VENDORED_DEPS_PIN = "vercel-internal-shared-vendored-deps==0.1.1";
5089
5090
  async function getQueueAdapterBootstrap({
5090
5091
  pythonPackage,
5091
5092
  env,
@@ -5115,6 +5116,7 @@ async function getQueueAdapterBootstrap({
5115
5116
  injectedPackages.push({
5116
5117
  name,
5117
5118
  requirement: name,
5119
+ extraRequirements: name.endsWith("-bundle") ? [QUEUE_ADAPTER_SHARED_VENDORED_DEPS_PIN] : [],
5118
5120
  envOverride: env[adapter.envOverride],
5119
5121
  allowLocalSource: false
5120
5122
  });
@@ -6669,6 +6671,10 @@ var RUNTIME_DEPS_DIR = "/tmp/_vc_deps";
6669
6671
  var MAX_LARGE_FUNCTION_UNCOMPRESSED_SIZE = 5 * 1024 * 1024 * 1024;
6670
6672
  var LARGE_FUNCTION_FILL_CEILING_BYTES = MAX_LARGE_FUNCTION_UNCOMPRESSED_SIZE - BYTECODE_FILL_MARGIN_BYTES;
6671
6673
  var BUNDLING_DOCS_LINK = "https://vercel.com/docs/functions/runtimes/python#controlling-what-gets-bundled";
6674
+ function runtimeInstallDisabledByFlag() {
6675
+ const flag = process.env.VERCEL_PYTHON_DISABLE_RUNTIME_INSTALL?.toLowerCase();
6676
+ return flag === "1" || flag === "true";
6677
+ }
6672
6678
  var PythonDependencyExternalizer = class {
6673
6679
  constructor(options) {
6674
6680
  this.allVendorFiles = {};
@@ -6682,10 +6688,11 @@ var PythonDependencyExternalizer = class {
6682
6688
  this.projectName = options.projectName;
6683
6689
  this.pythonVersion = options.pythonVersion;
6684
6690
  this.hasCustomCommand = options.hasCustomCommand;
6691
+ this.runtimeInstallDisabled = runtimeInstallDisabledByFlag();
6685
6692
  this.alwaysBundlePackages = options.alwaysBundlePackages ?? [];
6686
6693
  }
6687
6694
  shouldEnableRuntimeInstall() {
6688
- if (this.hasCustomCommand) {
6695
+ if (this.hasCustomCommand || this.runtimeInstallDisabled) {
6689
6696
  return false;
6690
6697
  }
6691
6698
  if (this.totalBundleSize <= LAMBDA_SIZE_THRESHOLD_BYTES || this.uvLockPath === null) {
@@ -6719,7 +6726,7 @@ var PythonDependencyExternalizer = class {
6719
6726
  totalSizeBytes: this.totalBundleSize,
6720
6727
  runtimeInstallEnabled
6721
6728
  });
6722
- if (this.totalBundleSize > LAMBDA_SIZE_THRESHOLD_BYTES && this.hasCustomCommand && !largeFunctionsEnabled) {
6729
+ if (this.totalBundleSize > LAMBDA_SIZE_THRESHOLD_BYTES && this.hasCustomCommand && !largeFunctionsEnabled && !this.runtimeInstallDisabled) {
6723
6730
  const limitMB = (LAMBDA_SIZE_THRESHOLD_BYTES / (1024 * 1024)).toFixed(0);
6724
6731
  throw new import_build_utils7.NowBuildError({
6725
6732
  code: "LAMBDA_SIZE_EXCEEDED",
@@ -6734,7 +6741,7 @@ function bundle size automatically. To fix this, you can:
6734
6741
  action: "Learn More"
6735
6742
  });
6736
6743
  }
6737
- if (largeFunctionsEnabled && this.totalBundleSize >= MAX_LARGE_FUNCTION_UNCOMPRESSED_SIZE) {
6744
+ if ((largeFunctionsEnabled || this.runtimeInstallDisabled) && this.totalBundleSize >= MAX_LARGE_FUNCTION_UNCOMPRESSED_SIZE) {
6738
6745
  const limitMB = (MAX_LARGE_FUNCTION_UNCOMPRESSED_SIZE / (1024 * 1024)).toFixed(0);
6739
6746
  throw new import_build_utils7.NowBuildError({
6740
6747
  code: "LAMBDA_SIZE_EXCEEDED",
@@ -9165,11 +9172,13 @@ async function doInstallInjectedDevPackage(pkg, opts) {
9165
9172
  );
9166
9173
  const pip = uvPath ? { cmd: uvPath, prefix: ["pip", "install"] } : { cmd: pythonBin, prefix: ["-m", "pip", "install"] };
9167
9174
  const excludeOverride = uvPath ? ["--exclude-newer-package", `${pkg.name}=false`] : [];
9175
+ const extras = pkg.envOverride || isLocalDev ? [] : pkg.extraRequirements ?? [];
9168
9176
  const spawnArgs = [
9169
9177
  ...pip.prefix,
9170
9178
  "--target",
9171
9179
  targetDir,
9172
9180
  ...excludeOverride,
9181
+ ...extras,
9173
9182
  dep
9174
9183
  ];
9175
9184
  await new Promise((resolve4, reject) => {
@@ -9527,6 +9536,7 @@ If you are using a virtual environment, activate it before running "vercel dev",
9527
9536
  {
9528
9537
  name: injectedPackage.name,
9529
9538
  requirement: injectedPackage.requirement,
9539
+ extraRequirements: injectedPackage.extraRequirements,
9530
9540
  envOverride: injectedPackage.envOverride
9531
9541
  },
9532
9542
  devOpts
@@ -11606,6 +11616,7 @@ async function getPythonLambdaOptions({
11606
11616
  async function installInjectedPackage({
11607
11617
  name,
11608
11618
  requirement,
11619
+ extraRequirements = [],
11609
11620
  envOverride,
11610
11621
  allowLocalSource,
11611
11622
  uv,
@@ -11616,6 +11627,7 @@ async function installInjectedPackage({
11616
11627
  const localDir = (0, import_path21.join)(__dirname, "..", "..", "..", "python", name);
11617
11628
  const isLocalDev = allowLocalSource && import_fs20.default.existsSync((0, import_path21.join)(localDir, "pyproject.toml"));
11618
11629
  const dep = envOverride || (isLocalDev ? localDir : requirement);
11630
+ const extras = envOverride || isLocalDev ? [] : extraRequirements;
11619
11631
  const noExclude = ["--exclude-newer-package", `${name}=false`];
11620
11632
  (0, import_build_utils24.debug)(`Installing ${dep}`);
11621
11633
  await uv.pip({
@@ -11627,6 +11639,7 @@ async function installInjectedPackage({
11627
11639
  "copy",
11628
11640
  ...pipPlatformArgs,
11629
11641
  ...noExclude,
11642
+ ...extras,
11630
11643
  dep
11631
11644
  ]
11632
11645
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/python",
3
- "version": "13.0.2",
3
+ "version": "13.0.4",
4
4
  "main": "./dist/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
@@ -17,7 +17,7 @@
17
17
  "@vercel/python-analysis": "0.14.0"
18
18
  },
19
19
  "peerDependencies": {
20
- "@vercel/build-utils": "14.9.2"
20
+ "@vercel/build-utils": "14.9.3"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@renovatebot/pep440": "4.2.1",
@@ -38,7 +38,7 @@
38
38
  "smol-toml": "1.5.2",
39
39
  "vitest": "4.1.10",
40
40
  "which": "3.0.0",
41
- "@vercel/build-utils": "14.9.2",
41
+ "@vercel/build-utils": "14.9.3",
42
42
  "@vercel/error-utils": "2.2.1",
43
43
  "@vercel/python-runtime": "0.22.1"
44
44
  },