@vercel/python 6.47.1 → 6.47.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.
Files changed (2) hide show
  1. package/dist/index.js +28 -0
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -8972,6 +8972,29 @@ function getTargetPlatform(isDev) {
8972
8972
  }
8973
8973
  return { uvPlatform: UV_LINUX_TARGET, architecture: "x86_64" };
8974
8974
  }
8975
+ async function getPythonLambdaOptions({
8976
+ config,
8977
+ entrypoint
8978
+ }) {
8979
+ if (!config?.functions) {
8980
+ return {};
8981
+ }
8982
+ const sources = /* @__PURE__ */ new Set([entrypoint]);
8983
+ if (entrypoint.endsWith(".py")) {
8984
+ sources.add(entrypoint.slice(0, -".py".length));
8985
+ }
8986
+ for (const sourceFile of sources) {
8987
+ const lambdaOptions = await (0, import_build_utils19.getLambdaOptionsFromFunction)({
8988
+ sourceFile,
8989
+ config
8990
+ });
8991
+ if (Object.keys(lambdaOptions).length > 0) {
8992
+ delete lambdaOptions.architecture;
8993
+ return lambdaOptions;
8994
+ }
8995
+ }
8996
+ return {};
8997
+ }
8975
8998
  async function installInjectedPackage({
8976
8999
  name,
8977
9000
  pinned,
@@ -9485,10 +9508,15 @@ var build = async ({
9485
9508
  ...files,
9486
9509
  [`${handlerPyFilename}.py`]: new import_build_utils19.FileBlob({ data: runtimeTrampoline })
9487
9510
  };
9511
+ const lambdaOptions = await getPythonLambdaOptions({
9512
+ config,
9513
+ entrypoint
9514
+ });
9488
9515
  const output = new import_build_utils19.Lambda({
9489
9516
  files: webFiles,
9490
9517
  handler: `${handlerPyFilename}.vc_handler`,
9491
9518
  runtime: pythonVersion.runtime,
9519
+ ...lambdaOptions,
9492
9520
  architecture: target.architecture,
9493
9521
  environment: lambdaEnv,
9494
9522
  supportsResponseStreaming: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/python",
3
- "version": "6.47.1",
3
+ "version": "6.47.2",
4
4
  "main": "./dist/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
@@ -37,8 +37,8 @@
37
37
  "vitest": "2.1.4",
38
38
  "which": "3.0.0",
39
39
  "@vercel/error-utils": "2.2.0",
40
- "@vercel/python-runtime": "0.15.0",
41
- "@vercel/build-utils": "13.31.0"
40
+ "@vercel/build-utils": "13.32.1",
41
+ "@vercel/python-runtime": "0.15.0"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "node ../../utils/build-builder.mjs",