@vercel/python 31.0.2 → 32.0.0-snapshot-23cc3b13430e

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 +120 -161
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -5055,7 +5055,7 @@ var import_fs22 = __toESM(require("fs"));
5055
5055
  var import_path23 = require("path");
5056
5056
 
5057
5057
  // src/package-versions.ts
5058
- var VERCEL_RUNTIME_VERSION = "0.24.2";
5058
+ var VERCEL_RUNTIME_VERSION = "0.24.3";
5059
5059
  var VERCEL_WORKERS_VERSION = "0.0.25";
5060
5060
 
5061
5061
  // src/conditional-vendoring.ts
@@ -5495,7 +5495,8 @@ var UvRunner = class {
5495
5495
  noBuild,
5496
5496
  noInstallProject,
5497
5497
  onlyGroup,
5498
- pythonPlatform
5498
+ pythonPlatform,
5499
+ workspacePackage
5499
5500
  } = options;
5500
5501
  const args = ["sync", "--active", "--no-dev", "--link-mode", "hardlink"];
5501
5502
  if (frozen) {
@@ -5515,6 +5516,9 @@ var UvRunner = class {
5515
5516
  if (pythonPlatform) {
5516
5517
  args.push("--python-platform", pythonPlatform);
5517
5518
  }
5519
+ if (workspacePackage) {
5520
+ args.push("--package", workspacePackage);
5521
+ }
5518
5522
  args.push("--no-editable");
5519
5523
  await this.runUvCmd(args, projectDir, venvPath);
5520
5524
  }
@@ -6512,6 +6516,15 @@ function detectInstallSource(pythonPackage, rootDir) {
6512
6516
  }
6513
6517
  return { manifestPath, manifestType, pythonPackage };
6514
6518
  }
6519
+ function getWorkspaceMemberName(pythonPackage) {
6520
+ const { manifest, workspaceManifest } = pythonPackage;
6521
+ if (!manifest || !workspaceManifest || manifest.origin)
6522
+ return void 0;
6523
+ if (manifest.path === workspaceManifest.path)
6524
+ return void 0;
6525
+ const name = manifest.data.project?.name;
6526
+ return typeof name === "string" && name ? name : void 0;
6527
+ }
6515
6528
  async function ensureUvProject({
6516
6529
  workPath,
6517
6530
  rootDir,
@@ -6524,13 +6537,19 @@ async function ensureUvProject({
6524
6537
  }) {
6525
6538
  const { manifestType } = detectInstallSource(pythonPackage, rootDir);
6526
6539
  const manifest = pythonPackage.manifest;
6540
+ const workspacePackage = manifestType === "pylock.toml" ? void 0 : getWorkspaceMemberName(pythonPackage);
6527
6541
  let projectDir;
6528
6542
  let pyprojectPath;
6529
6543
  let lockPath = null;
6530
6544
  let lockFileProvidedByUser = false;
6545
+ if (workspacePackage) {
6546
+ console.log(
6547
+ `Installing the dependencies of uv workspace member "${workspacePackage}" only`
6548
+ );
6549
+ }
6531
6550
  if (manifestType === "uv.lock" || manifestType === "pylock.toml") {
6532
6551
  lockFileProvidedByUser = true;
6533
- const lockFile = pythonPackage.manifest?.lockFile ?? pythonPackage.workspaceLockFile;
6552
+ const lockFile = (workspacePackage ? pythonPackage.workspaceLockFile : void 0) ?? pythonPackage.manifest?.lockFile ?? pythonPackage.workspaceLockFile;
6534
6553
  if (!lockFile) {
6535
6554
  throw new Error(
6536
6555
  `Expected lock file path to be resolved, but it was null`
@@ -6572,13 +6591,14 @@ async function ensureUvProject({
6572
6591
  if (workspaceLockFile) {
6573
6592
  lockPath = (0, import_path6.join)(rootDir, workspaceLockFile.path);
6574
6593
  } else {
6575
- await restoreCachedLock(cachedLockPath, projectDir);
6594
+ const lockDir = workspacePackage && pythonPackage.workspaceManifest ? (0, import_path6.join)(rootDir, (0, import_path6.dirname)(pythonPackage.workspaceManifest.path)) : projectDir;
6595
+ await restoreCachedLock(cachedLockPath, lockDir);
6576
6596
  await uv.lock({
6577
6597
  projectDir,
6578
6598
  venvPath,
6579
6599
  ...requireBinaryWheels ? { noBuild: true, upgrade: true } : {}
6580
6600
  });
6581
- lockPath = (0, import_path6.join)(projectDir, "uv.lock");
6601
+ lockPath = (0, import_path6.join)(lockDir, "uv.lock");
6582
6602
  }
6583
6603
  } else {
6584
6604
  projectDir = workPath;
@@ -6606,7 +6626,8 @@ async function ensureUvProject({
6606
6626
  projectDir,
6607
6627
  pyprojectPath,
6608
6628
  lockPath: resolvedLockPath,
6609
- lockFileProvidedByUser
6629
+ lockFileProvidedByUser,
6630
+ workspacePackage
6610
6631
  };
6611
6632
  }
6612
6633
  async function pipInstall(pipPath, uvPath, workPath, args, targetDir) {
@@ -6716,6 +6737,15 @@ function isLargeFunctionsEnabled() {
6716
6737
 
6717
6738
  // src/dependency-externalizer.ts
6718
6739
  var readFile = (0, import_util.promisify)(import_fs6.default.readFile);
6740
+ function restorePyPIProxyUrls(lockContent) {
6741
+ return lockContent.replace(
6742
+ /(["'])http:\/\/127\.0\.0\.1:8402\/_pypi\/simple(?=\/|["'?#\s]|$)/g,
6743
+ "$1https://pypi.org/simple"
6744
+ ).replace(
6745
+ /(["'])http:\/\/127\.0\.0\.1:8402\/_pypi\/files(?=\/|["'?#\s]|$)/g,
6746
+ "$1https://files.pythonhosted.org"
6747
+ );
6748
+ }
6719
6749
  var LAMBDA_SIZE_THRESHOLD_BYTES = 225 * 1024 * 1024;
6720
6750
  var BYTECODE_FILL_MARGIN_BYTES = 5 * 1024 * 1024;
6721
6751
  var BYTECODE_FILL_CEILING_BYTES = LAMBDA_SIZE_THRESHOLD_BYTES - BYTECODE_FILL_MARGIN_BYTES;
@@ -6740,6 +6770,7 @@ var PythonDependencyExternalizer = class {
6740
6770
  this.uvLockPath = options.uvLockPath;
6741
6771
  this.uvProjectDir = options.uvProjectDir;
6742
6772
  this.projectName = options.projectName;
6773
+ this.workspacePackage = options.workspacePackage;
6743
6774
  this.pythonVersion = options.pythonVersion;
6744
6775
  this.hasCustomCommand = options.hasCustomCommand;
6745
6776
  this.runtimeInstallDisabled = runtimeInstallDisabledByFlag();
@@ -6866,9 +6897,10 @@ smaller functions.`,
6866
6897
  message: `Failed to read the uv.lock file at "${relLockPath}".`
6867
6898
  });
6868
6899
  }
6900
+ const runtimeLockContent = restorePyPIProxyUrls(lockContent);
6869
6901
  let lockFile;
6870
6902
  try {
6871
- lockFile = (0, import_python_analysis6.parseUvLock)(lockContent, relLockPath);
6903
+ lockFile = (0, import_python_analysis6.parseUvLock)(runtimeLockContent, relLockPath);
6872
6904
  } catch (error) {
6873
6905
  if (error instanceof import_python_analysis6.PythonAnalysisError) {
6874
6906
  if (error.fileContent) {
@@ -6895,6 +6927,11 @@ ${error.fileContent}`
6895
6927
  lockFile,
6896
6928
  excludePackages
6897
6929
  });
6930
+ if (this.workspacePackage) {
6931
+ classification.publicPackages = classification.publicPackages.filter(
6932
+ (name) => this.installedDistributions.getInstalledVersion(name) !== null
6933
+ );
6934
+ }
6898
6935
  (0, import_build_utils7.debug)(
6899
6936
  `Package classification: ${classification.privatePackages.length} private, ${classification.publicPackages.length} public`
6900
6937
  );
@@ -7023,7 +7060,8 @@ To fix this, either:
7023
7060
  }
7024
7061
  const runtimeConfigData = JSON.stringify({
7025
7062
  projectDir: isOutsideWorkPath ? UV_BUNDLE_DIR : projectDirRel,
7026
- bundledPackages: bundledPackagesForConfig
7063
+ bundledPackages: bundledPackagesForConfig,
7064
+ ...this.workspacePackage ? { workspacePackage: this.workspacePackage } : {}
7027
7065
  });
7028
7066
  files[`${UV_BUNDLE_DIR}/_runtime_config.json`] = new import_build_utils7.FileBlob({
7029
7067
  data: runtimeConfigData
@@ -7069,6 +7107,13 @@ functions.`,
7069
7107
  action: "Learn More"
7070
7108
  });
7071
7109
  }
7110
+ if (runtimeLockContent !== lockContent) {
7111
+ const bundleLockPath = isOutsideWorkPath ? `${UV_BUNDLE_DIR}/uv.lock` : uvLockRel;
7112
+ files[bundleLockPath] = new import_build_utils7.FileBlob({
7113
+ data: runtimeLockContent,
7114
+ mode: files[bundleLockPath]?.mode
7115
+ });
7116
+ }
7072
7117
  const toolingFiles = {};
7073
7118
  for (const key of [
7074
7119
  `${UV_BUNDLE_DIR}/uv`,
@@ -8794,7 +8839,7 @@ var DependencyScanner = class _DependencyScanner {
8794
8839
  if (env.VERCEL_PYPI_LOCKFILE_SCANNER !== "1") {
8795
8840
  return void 0;
8796
8841
  }
8797
- const enforce = env.VERCEL_ENABLE_BLOCKED_PACKAGE_ENFORCEMENT === "1";
8842
+ const enforce = env.VERCEL_ENABLE_PYPI_BLOCKED_PACKAGE_ENFORCEMENT === "1";
8798
8843
  return span.child(MANIFEST_TELEMETRY.spanName).trace(async (manifestSpan) => {
8799
8844
  const report = (fields) => reportTelemetry(manifestSpan, MANIFEST_TELEMETRY, {
8800
8845
  mode: modeLabel(enforce),
@@ -9541,35 +9586,10 @@ function moduleColonFuncToCronPath(serviceName, moduleFunction) {
9541
9586
  return (0, import_build_utils13.getInternalServiceCronPath)(serviceName, entrypointPath, funcPart);
9542
9587
  }
9543
9588
 
9544
- // src/schedules.ts
9545
- function getGeneratedScheduleHandlerPath(outputPath) {
9546
- return `_vc_schedule_handlers/${outputPath.replace(/[^A-Za-z0-9]+/g, "_")}.py`;
9547
- }
9548
- function createScheduleHandlerModule({ entrypoints }, rootDir) {
9549
- const entries = entrypoints.flatMap(
9550
- ({ sourceFile, scheduleNames }) => scheduleNames.map(
9551
- (name) => ` ${JSON.stringify(name)}: os.path.join(_root, ${JSON.stringify(sourceFile)}),`
9552
- )
9553
- );
9554
- return [
9555
- "import os.path",
9556
- "",
9557
- "from vercel_runtime.schedules import create_schedule_scripts_app",
9558
- "",
9559
- rootDir === void 0 ? "_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))" : `_root = ${JSON.stringify(rootDir)}`,
9560
- "app = create_schedule_scripts_app({",
9561
- ...entries,
9562
- "})",
9563
- ""
9564
- ].join("\n");
9565
- }
9566
-
9567
9589
  // src/start-dev-server.ts
9568
9590
  var import_child_process2 = require("child_process");
9569
- var import_crypto2 = require("crypto");
9570
9591
  var import_fs15 = require("fs");
9571
9592
  var import_path15 = require("path");
9572
- var import_util6 = require("util");
9573
9593
  var import_build_utils16 = require("@vercel/build-utils");
9574
9594
  var import_get_port = __toESM(require_get_port());
9575
9595
  var import_is_port_reachable = __toESM(require_is_port_reachable());
@@ -10844,20 +10864,16 @@ async function getMultiServicePythonRunner(workPath, env, systemPython, uvPath)
10844
10864
  env.PATH = `${binDir}${import_path15.delimiter}${env.PATH || ""}`;
10845
10865
  return { command: pythonBin, args: [] };
10846
10866
  }
10847
- async function claimPersistentServer(serverKey, isStale) {
10867
+ async function claimPersistentServer(serverKey) {
10848
10868
  while (true) {
10849
10869
  const existing = PERSISTENT_SERVERS.get(serverKey);
10850
10870
  if (existing) {
10851
- if (isStale?.(existing)) {
10852
- killPersistentServer(serverKey);
10853
- } else {
10854
- return {
10855
- port: existing.port,
10856
- pid: existing.pid,
10857
- shutdown: async () => {
10858
- }
10859
- };
10860
- }
10871
+ return {
10872
+ port: existing.port,
10873
+ pid: existing.pid,
10874
+ shutdown: async () => {
10875
+ }
10876
+ };
10861
10877
  }
10862
10878
  const pending = PENDING_STARTS.get(serverKey);
10863
10879
  if (!pending)
@@ -10889,9 +10905,7 @@ async function spawnPersistentServer({
10889
10905
  port: requestedPort,
10890
10906
  env,
10891
10907
  onStdout,
10892
- onStderr,
10893
- scheduleModule,
10894
- scheduleEnv
10908
+ onStderr
10895
10909
  }) {
10896
10910
  const port = requestedPort ?? await (0, import_get_port.default)();
10897
10911
  env.PORT = `${port}`;
@@ -10963,9 +10977,7 @@ async function spawnPersistentServer({
10963
10977
  pid,
10964
10978
  child,
10965
10979
  stdoutLogListener,
10966
- stderrLogListener,
10967
- scheduleModule,
10968
- scheduleEnv
10980
+ stderrLogListener
10969
10981
  });
10970
10982
  return { port, pid };
10971
10983
  }
@@ -11078,20 +11090,13 @@ var startDevServer = async (opts) => {
11078
11090
  onStderr
11079
11091
  } = opts;
11080
11092
  const framework = config?.framework;
11081
- const scheduleFunction = config?.scheduleFunction;
11082
- const scheduleHandlerPath = scheduleFunction && `_vc_schedule_handlers/schedule_${(0, import_crypto2.createHash)("sha256").update(scheduleFunction.outputPath).digest("hex")}.py`;
11083
- const scheduleModule = scheduleFunction && createScheduleHandlerModule(scheduleFunction, workPath);
11084
11093
  const env = { ...process.env, ...meta.env || {} };
11085
- const scheduleEnv = scheduleFunction ? { ...env } : void 0;
11086
11094
  const serviceName = service?.name ?? (typeof meta.serviceName === "string" ? meta.serviceName : void 0);
11087
- const serverKey = scheduleFunction ? `${workPath}::schedule::${scheduleFunction.outputPath}` : serviceName ? `${workPath}::${framework}::${serviceName}` : `${workPath}::${framework}`;
11088
- if (!framework && !scheduleFunction) {
11095
+ const serverKey = serviceName ? `${workPath}::${framework}::${serviceName}` : `${workPath}::${framework}`;
11096
+ if (!framework) {
11089
11097
  return null;
11090
11098
  }
11091
- const start = await claimPersistentServer(
11092
- serverKey,
11093
- (info) => !!scheduleFunction && (info.scheduleModule !== scheduleModule || !(0, import_util6.isDeepStrictEqual)(info.scheduleEnv, scheduleEnv))
11094
- );
11099
+ const start = await claimPersistentServer(serverKey);
11095
11100
  if ("port" in start) {
11096
11101
  return start;
11097
11102
  }
@@ -11105,12 +11110,7 @@ var startDevServer = async (opts) => {
11105
11110
  const handlerFunction = typeof config?.handlerFunction === "string" ? config.handlerFunction : void 0;
11106
11111
  const isPyQueueSidecar = config?.pythonQueueSidecar === "subscriber" || config?.pythonQueueSidecar === "workflow";
11107
11112
  let detected;
11108
- if (scheduleHandlerPath && scheduleModule) {
11109
- const entrypoint2 = import_path15.posix.join(".vercel/python", scheduleHandlerPath);
11110
- (0, import_fs15.mkdirSync)((0, import_path15.dirname)((0, import_path15.join)(workPath, entrypoint2)), { recursive: true });
11111
- (0, import_fs15.writeFileSync)((0, import_path15.join)(workPath, entrypoint2), scheduleModule);
11112
- detected = { entrypoint: { entrypoint: entrypoint2, variableName: "app" } };
11113
- } else if (isPyprojectEntrypoint) {
11113
+ if (isPyprojectEntrypoint) {
11114
11114
  const declaredEntrypoint = await getVercelToolsEntrypoint(
11115
11115
  workPath,
11116
11116
  opts.repoRootPath
@@ -11152,7 +11152,7 @@ var startDevServer = async (opts) => {
11152
11152
  });
11153
11153
  }
11154
11154
  const { entrypoint: entry, variableName } = resolved;
11155
- const modulePath = scheduleHandlerPath ? generatedPythonPathToModule(scheduleHandlerPath) : entrypointToModule(entry);
11155
+ const modulePath = entrypointToModule(entry);
11156
11156
  const { pythonPath: systemPython } = getDefaultPythonVersion(meta);
11157
11157
  const uvPath = await findUvBinary(systemPython);
11158
11158
  if (uvPath) {
@@ -11281,7 +11281,7 @@ If you are using a virtual environment, activate it before running "vercel dev",
11281
11281
  );
11282
11282
  }
11283
11283
  const apschedulerSubscribers = [];
11284
- if (!legacyProject && !scheduleFunction) {
11284
+ if (!legacyProject) {
11285
11285
  const runtimeDir = (0, import_path15.join)(workPath, ".vercel", "python");
11286
11286
  const declaredSubscribers = await getPyprojectSubscribers(workPath);
11287
11287
  const introspectionEnv = {
@@ -11397,8 +11397,8 @@ If you are using a virtual environment, activate it before running "vercel dev",
11397
11397
  workPath,
11398
11398
  entry,
11399
11399
  modulePath,
11400
- shimSubdir: scheduleHandlerPath ? scheduleHandlerPath.replace(/\.py$/, "") : serviceName && import_path15.posix.join("services", serviceName),
11401
- framework: framework ?? "python",
11400
+ shimSubdir: serviceName && import_path15.posix.join("services", serviceName),
11401
+ framework,
11402
11402
  variableName: variableName ?? "",
11403
11403
  extraPythonPath: hookResult?.extraPythonPath,
11404
11404
  spawnCommand,
@@ -11406,9 +11406,7 @@ If you are using a virtual environment, activate it before running "vercel dev",
11406
11406
  port: typeof meta.port === "number" ? meta.port : void 0,
11407
11407
  env,
11408
11408
  onStdout,
11409
- onStderr,
11410
- scheduleModule,
11411
- scheduleEnv
11409
+ onStderr
11412
11410
  });
11413
11411
  start.resolve({ port, pid });
11414
11412
  const shutdown = async () => {
@@ -13126,11 +13124,11 @@ function getTargetPlatform(isDev) {
13126
13124
  }
13127
13125
  return { uvPlatform: UV_LINUX_TARGET, architecture: "x86_64" };
13128
13126
  }
13129
- function getMatchingFunction(config, entrypoint, isScheduleEntrypoint = false) {
13127
+ function getMatchingFunction(config, entrypoint) {
13130
13128
  if (!entrypoint) {
13131
13129
  return;
13132
13130
  }
13133
- const candidates = entrypoint.endsWith(".py") && !isScheduleEntrypoint ? [entrypoint, entrypoint.slice(0, -".py".length)] : [entrypoint];
13131
+ const candidates = entrypoint.endsWith(".py") ? [entrypoint, entrypoint.slice(0, -".py".length)] : [entrypoint];
13134
13132
  return (0, import_build_utils25.findMatchingFunction)(config?.functions, candidates);
13135
13133
  }
13136
13134
  function normalizeGlobs(value) {
@@ -13138,14 +13136,12 @@ function normalizeGlobs(value) {
13138
13136
  }
13139
13137
  async function getPythonLambdaOptions({
13140
13138
  config,
13141
- entrypoint,
13142
- isScheduleEntrypoint = false
13139
+ entrypoint
13143
13140
  }) {
13144
- const match = getMatchingFunction(config, entrypoint, isScheduleEntrypoint);
13141
+ const match = getMatchingFunction(config, entrypoint);
13145
13142
  const lambdaOptions = await (0, import_build_utils25.getLambdaOptionsFromFunction)({
13146
13143
  sourceFile: match?.sourceFile ?? entrypoint,
13147
- config,
13148
- isScheduleEntrypoint
13144
+ config
13149
13145
  });
13150
13146
  delete lambdaOptions.architecture;
13151
13147
  return lambdaOptions;
@@ -13274,7 +13270,7 @@ async function runUvManagedInstall({
13274
13270
  requireBinaryWheels: false,
13275
13271
  cachedLockPath
13276
13272
  });
13277
- const { projectDir, lockPath, lockFileProvidedByUser } = result;
13273
+ const { projectDir, lockPath, lockFileProvidedByUser, workspacePackage } = result;
13278
13274
  if (extraSyncParams !== void 0) {
13279
13275
  if (!lockFileProvidedByUser) {
13280
13276
  await dependencyScanner?.scanGeneratedLockfile({
@@ -13290,6 +13286,7 @@ async function runUvManagedInstall({
13290
13286
  frozen: lockFileProvidedByUser,
13291
13287
  locked: !lockFileProvidedByUser,
13292
13288
  pythonPlatform,
13289
+ workspacePackage,
13293
13290
  ...extraSyncParams
13294
13291
  });
13295
13292
  }
@@ -13305,6 +13302,7 @@ async function packFunctionBundle({
13305
13302
  uvLockPath,
13306
13303
  uvProjectDir,
13307
13304
  projectName,
13305
+ workspacePackage,
13308
13306
  pythonVersion,
13309
13307
  hasCustomCommand,
13310
13308
  alwaysBundlePackages,
@@ -13359,6 +13357,7 @@ async function packFunctionBundle({
13359
13357
  uvLockPath,
13360
13358
  uvProjectDir,
13361
13359
  projectName,
13360
+ workspacePackage,
13362
13361
  pythonVersion,
13363
13362
  hasCustomCommand,
13364
13363
  alwaysBundlePackages
@@ -13695,7 +13694,11 @@ async function buildProxyMiddleware({
13695
13694
  meta
13696
13695
  });
13697
13696
  const proxySyncParams = "vercel-proxy" in (pythonPackage?.manifest?.data?.["dependency-groups"] ?? {}) ? { onlyGroup: "vercel.proxy", noInstallProject: true } : void 0;
13698
- const { projectDir, lockPath: uvLockPath } = await builderSpan.child(import_build_utils25.BUILDER_INSTALLER_STEP, {
13697
+ const {
13698
+ projectDir,
13699
+ lockPath: uvLockPath,
13700
+ workspacePackage
13701
+ } = await builderSpan.child(import_build_utils25.BUILDER_INSTALLER_STEP, {
13699
13702
  runtime: "python",
13700
13703
  "python.cache.restored": restoredCache
13701
13704
  }).trace(async (installSpan) => {
@@ -13760,6 +13763,7 @@ async function buildProxyMiddleware({
13760
13763
  uvLockPath,
13761
13764
  uvProjectDir: projectDir,
13762
13765
  projectName,
13766
+ workspacePackage,
13763
13767
  pythonVersion,
13764
13768
  hasCustomCommand: false,
13765
13769
  alwaysBundlePackages: [],
@@ -13897,8 +13901,6 @@ var build = async ({
13897
13901
  throw err;
13898
13902
  }
13899
13903
  let detected;
13900
- const scheduleFunction = config?.scheduleFunction;
13901
- const scheduleEntrypoint = scheduleFunction?.entrypoints[0];
13902
13904
  const handlerFunction = typeof config?.handlerFunction === "string" ? config.handlerFunction : void 0;
13903
13905
  if (isPyprojectEntrypoint) {
13904
13906
  const declared = await getVercelToolsEntrypoint(workPath, repoRootPath);
@@ -13911,13 +13913,6 @@ var build = async ({
13911
13913
  });
13912
13914
  }
13913
13915
  entrypoint = void 0;
13914
- } else if (scheduleEntrypoint) {
13915
- detected = {
13916
- entrypoint: {
13917
- entrypoint: scheduleEntrypoint.sourceFile,
13918
- variableName: ""
13919
- }
13920
- };
13921
13916
  } else {
13922
13917
  detected = await detectPythonEntrypoint(
13923
13918
  config.framework,
@@ -13981,6 +13976,7 @@ var build = async ({
13981
13976
  let uvLockPath = null;
13982
13977
  let uvProjectDir = null;
13983
13978
  let projectName;
13979
+ let workspacePackage;
13984
13980
  let usedUvManagedInstall = false;
13985
13981
  await builderSpan.child(import_build_utils25.BUILDER_INSTALLER_STEP, {
13986
13982
  installCommand: projectInstallCommand || void 0,
@@ -14022,7 +14018,7 @@ var build = async ({
14022
14018
  }
14023
14019
  }
14024
14020
  if (!assumeDepsInstalled) {
14025
- const { projectDir, lockPath } = await runUvManagedInstall({
14021
+ const installed = await runUvManagedInstall({
14026
14022
  workPath,
14027
14023
  rootDir,
14028
14024
  venvPath,
@@ -14036,8 +14032,9 @@ var build = async ({
14036
14032
  dependencyScanner,
14037
14033
  installSpan
14038
14034
  });
14039
- uvLockPath = lockPath;
14040
- uvProjectDir = projectDir;
14035
+ uvLockPath = installed.lockPath;
14036
+ uvProjectDir = installed.projectDir;
14037
+ workspacePackage = installed.workspacePackage;
14041
14038
  projectName = pythonPackage?.manifest?.data?.project?.name;
14042
14039
  usedUvManagedInstall = true;
14043
14040
  }
@@ -14277,35 +14274,33 @@ var build = async ({
14277
14274
  });
14278
14275
  }
14279
14276
  }
14280
- if (!scheduleEntrypoint) {
14281
- const moduleName = entrypointToModule(entrypoint);
14282
- const suffix = meta.isDev && !entrypoint.endsWith(".py") ? ".py" : "";
14283
- const entrypointWithSuffix = `${entrypoint}${suffix}`;
14284
- (0, import_build_utils25.debug)("Entrypoint with suffix is", entrypointWithSuffix);
14285
- crons = await getServiceCrons({
14286
- service,
14287
- entrypoint,
14288
- rawEntrypoint,
14289
- handlerFunction,
14290
- pythonBin: getVenvPythonBin(venvPath),
14291
- env: pythonEnv,
14292
- workPath
14293
- });
14294
- const extraTrampolineEnv = [];
14295
- if (crons?.length) {
14296
- const json = JSON.stringify(buildCronRouteTable(crons));
14297
- (0, import_assert.default)(!json.includes("\\"), `backslash in cron route table: ${json}`);
14298
- extraTrampolineEnv.push(`"__VC_CRON_ROUTES": '${json}'`);
14299
- }
14300
- const variableName = resolved?.variableName ?? "";
14301
- runtimeTrampoline = createRuntimeTrampoline({
14302
- moduleName,
14303
- entrypoint: entrypointWithSuffix,
14304
- vendorDir,
14305
- variableName,
14306
- extraEnv: extraTrampolineEnv
14307
- });
14277
+ const moduleName = entrypointToModule(entrypoint);
14278
+ const suffix = meta.isDev && !entrypoint.endsWith(".py") ? ".py" : "";
14279
+ const entrypointWithSuffix = `${entrypoint}${suffix}`;
14280
+ (0, import_build_utils25.debug)("Entrypoint with suffix is", entrypointWithSuffix);
14281
+ crons = await getServiceCrons({
14282
+ service,
14283
+ entrypoint,
14284
+ rawEntrypoint,
14285
+ handlerFunction,
14286
+ pythonBin: getVenvPythonBin(venvPath),
14287
+ env: pythonEnv,
14288
+ workPath
14289
+ });
14290
+ const extraTrampolineEnv = [];
14291
+ if (crons?.length) {
14292
+ const json = JSON.stringify(buildCronRouteTable(crons));
14293
+ (0, import_assert.default)(!json.includes("\\"), `backslash in cron route table: ${json}`);
14294
+ extraTrampolineEnv.push(`"__VC_CRON_ROUTES": '${json}'`);
14308
14295
  }
14296
+ const variableName = resolved?.variableName ?? "";
14297
+ runtimeTrampoline = createRuntimeTrampoline({
14298
+ moduleName,
14299
+ entrypoint: entrypointWithSuffix,
14300
+ vendorDir,
14301
+ variableName,
14302
+ extraEnv: extraTrampolineEnv
14303
+ });
14309
14304
  }
14310
14305
  const compileAllEnabled = shouldCompileAll({
14311
14306
  isDev: meta.isDev,
@@ -14340,8 +14335,7 @@ var build = async ({
14340
14335
  }
14341
14336
  const functionConfig = getMatchingFunction(
14342
14337
  config,
14343
- entrypoint,
14344
- scheduleEntrypoint !== void 0
14338
+ entrypoint
14345
14339
  )?.functionConfig;
14346
14340
  const includeFilesPatterns = [
14347
14341
  ...normalizeGlobs(config?.includeFiles),
@@ -14377,6 +14371,7 @@ var build = async ({
14377
14371
  uvLockPath,
14378
14372
  uvProjectDir,
14379
14373
  projectName,
14374
+ workspacePackage,
14380
14375
  pythonVersion,
14381
14376
  hasCustomCommand,
14382
14377
  alwaysBundlePackages: [
@@ -14592,42 +14587,6 @@ var build = async ({
14592
14587
  );
14593
14588
  }
14594
14589
  }
14595
- if (scheduleFunction && scheduleEntrypoint) {
14596
- const lambdaOptions = await getPythonLambdaOptions({
14597
- config,
14598
- entrypoint: scheduleEntrypoint.sourceFile,
14599
- isScheduleEntrypoint: true
14600
- });
14601
- const generatedPath = getGeneratedScheduleHandlerPath(
14602
- scheduleFunction.outputPath
14603
- );
14604
- const scheduleLambda = new import_build_utils25.Lambda({
14605
- files: {
14606
- ...files,
14607
- [generatedPath]: new import_build_utils25.FileBlob({
14608
- data: createScheduleHandlerModule(scheduleFunction)
14609
- }),
14610
- [`${handlerPyFilename}.py`]: new import_build_utils25.FileBlob({
14611
- data: createRuntimeTrampoline({
14612
- moduleName: generatedPythonPathToModule(generatedPath),
14613
- entrypoint: generatedPath,
14614
- vendorDir,
14615
- variableName: "app"
14616
- })
14617
- })
14618
- },
14619
- handler: `${handlerPyFilename}.vc_handler`,
14620
- runtime: pythonVersion.runtime,
14621
- ...lambdaOptions,
14622
- architecture: target.architecture,
14623
- environment: { ...lambdaEnv },
14624
- supportsResponseStreaming: true
14625
- });
14626
- return {
14627
- resultVersion: 2,
14628
- result: { output: { [scheduleFunction.outputPath]: scheduleLambda } }
14629
- };
14630
- }
14631
14590
  if (!(0, import_build_utils25.isPythonFramework)(framework) && !service?.name && !isPyprojectEntrypoint) {
14632
14591
  (0, import_assert.default)(output, "web Lambda must exist for non-service builds");
14633
14592
  return { resultVersion: 3, result: { output } };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/python",
3
- "version": "31.0.2",
3
+ "version": "32.0.0-snapshot-23cc3b13430e",
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.15.3"
18
18
  },
19
19
  "peerDependencies": {
20
- "@vercel/build-utils": "15.3.0"
20
+ "@vercel/build-utils": "15.4.0-snapshot-23cc3b13430e"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@renovatebot/pep440": "4.2.1",
@@ -37,9 +37,9 @@
37
37
  "smol-toml": "1.5.2",
38
38
  "vitest": "4.1.10",
39
39
  "which": "3.0.0",
40
- "@vercel/python-runtime": "0.24.2",
41
- "@vercel/build-utils": "15.3.0",
42
- "@vercel/error-utils": "2.2.1"
40
+ "@vercel/error-utils": "2.2.1",
41
+ "@vercel/build-utils": "15.4.0-snapshot-23cc3b13430e",
42
+ "@vercel/python-runtime": "0.24.3"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "node ../../utils/build-builder.mjs",