@vercel/python 6.47.1 → 6.47.3

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 +30 -2
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -4380,7 +4380,7 @@ var import_fs15 = __toESM(require("fs"));
4380
4380
  var import_path15 = require("path");
4381
4381
 
4382
4382
  // src/package-versions.ts
4383
- var VERCEL_RUNTIME_VERSION = "0.15.0";
4383
+ var VERCEL_RUNTIME_VERSION = "0.16.0";
4384
4384
  var VERCEL_WORKERS_VERSION = "0.0.25";
4385
4385
 
4386
4386
  // src/index.ts
@@ -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
@@ -9549,7 +9577,7 @@ var build = async ({
9549
9577
  if (!(0, import_build_utils19.isPythonFramework)(framework) && !service?.name) {
9550
9578
  return { resultVersion: 3, result: { output } };
9551
9579
  }
9552
- const lambdaPath = service?.name ? `_svc/${service.name}/index` : "index";
9580
+ const lambdaPath = service?.name && service.type ? `_svc/${service.name}/index` : "index";
9553
9581
  const staticFiles = djangoStatic?.cdnOutputDir ? await (0, import_build_utils19.glob)("**", { cwd: djangoStatic.cdnOutputDir }) : {};
9554
9582
  const isNonWebService = service?.name && service.type && service.type !== "web";
9555
9583
  const routes = isNonWebService ? void 0 : [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/python",
3
- "version": "6.47.1",
3
+ "version": "6.47.3",
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.32.1",
39
40
  "@vercel/error-utils": "2.2.0",
40
- "@vercel/python-runtime": "0.15.0",
41
- "@vercel/build-utils": "13.31.0"
41
+ "@vercel/python-runtime": "0.16.0"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "node ../../utils/build-builder.mjs",