@vercel/python 31.0.2 → 32.0.0-snapshot-579f9b2619d8

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 +124 -162
  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;
@@ -6729,6 +6759,9 @@ function runtimeInstallDisabledByFlag() {
6729
6759
  const flag = process.env.VERCEL_PYTHON_DISABLE_RUNTIME_INSTALL?.toLowerCase();
6730
6760
  return flag === "1" || flag === "true";
6731
6761
  }
6762
+ function isPythonOnHive() {
6763
+ return process.env.VERCEL_PYTHON_ON_HIVE === "1";
6764
+ }
6732
6765
  var PythonDependencyExternalizer = class {
6733
6766
  constructor(options) {
6734
6767
  this.allVendorFiles = {};
@@ -6740,9 +6773,10 @@ var PythonDependencyExternalizer = class {
6740
6773
  this.uvLockPath = options.uvLockPath;
6741
6774
  this.uvProjectDir = options.uvProjectDir;
6742
6775
  this.projectName = options.projectName;
6776
+ this.workspacePackage = options.workspacePackage;
6743
6777
  this.pythonVersion = options.pythonVersion;
6744
6778
  this.hasCustomCommand = options.hasCustomCommand;
6745
- this.runtimeInstallDisabled = runtimeInstallDisabledByFlag();
6779
+ this.runtimeInstallDisabled = runtimeInstallDisabledByFlag() || isPythonOnHive();
6746
6780
  this.alwaysBundlePackages = options.alwaysBundlePackages ?? [];
6747
6781
  }
6748
6782
  shouldEnableRuntimeInstall() {
@@ -6866,9 +6900,10 @@ smaller functions.`,
6866
6900
  message: `Failed to read the uv.lock file at "${relLockPath}".`
6867
6901
  });
6868
6902
  }
6903
+ const runtimeLockContent = restorePyPIProxyUrls(lockContent);
6869
6904
  let lockFile;
6870
6905
  try {
6871
- lockFile = (0, import_python_analysis6.parseUvLock)(lockContent, relLockPath);
6906
+ lockFile = (0, import_python_analysis6.parseUvLock)(runtimeLockContent, relLockPath);
6872
6907
  } catch (error) {
6873
6908
  if (error instanceof import_python_analysis6.PythonAnalysisError) {
6874
6909
  if (error.fileContent) {
@@ -6895,6 +6930,11 @@ ${error.fileContent}`
6895
6930
  lockFile,
6896
6931
  excludePackages
6897
6932
  });
6933
+ if (this.workspacePackage) {
6934
+ classification.publicPackages = classification.publicPackages.filter(
6935
+ (name) => this.installedDistributions.getInstalledVersion(name) !== null
6936
+ );
6937
+ }
6898
6938
  (0, import_build_utils7.debug)(
6899
6939
  `Package classification: ${classification.privatePackages.length} private, ${classification.publicPackages.length} public`
6900
6940
  );
@@ -7023,7 +7063,8 @@ To fix this, either:
7023
7063
  }
7024
7064
  const runtimeConfigData = JSON.stringify({
7025
7065
  projectDir: isOutsideWorkPath ? UV_BUNDLE_DIR : projectDirRel,
7026
- bundledPackages: bundledPackagesForConfig
7066
+ bundledPackages: bundledPackagesForConfig,
7067
+ ...this.workspacePackage ? { workspacePackage: this.workspacePackage } : {}
7027
7068
  });
7028
7069
  files[`${UV_BUNDLE_DIR}/_runtime_config.json`] = new import_build_utils7.FileBlob({
7029
7070
  data: runtimeConfigData
@@ -7069,6 +7110,13 @@ functions.`,
7069
7110
  action: "Learn More"
7070
7111
  });
7071
7112
  }
7113
+ if (runtimeLockContent !== lockContent) {
7114
+ const bundleLockPath = isOutsideWorkPath ? `${UV_BUNDLE_DIR}/uv.lock` : uvLockRel;
7115
+ files[bundleLockPath] = new import_build_utils7.FileBlob({
7116
+ data: runtimeLockContent,
7117
+ mode: files[bundleLockPath]?.mode
7118
+ });
7119
+ }
7072
7120
  const toolingFiles = {};
7073
7121
  for (const key of [
7074
7122
  `${UV_BUNDLE_DIR}/uv`,
@@ -8794,7 +8842,7 @@ var DependencyScanner = class _DependencyScanner {
8794
8842
  if (env.VERCEL_PYPI_LOCKFILE_SCANNER !== "1") {
8795
8843
  return void 0;
8796
8844
  }
8797
- const enforce = env.VERCEL_ENABLE_BLOCKED_PACKAGE_ENFORCEMENT === "1";
8845
+ const enforce = env.VERCEL_ENABLE_PYPI_BLOCKED_PACKAGE_ENFORCEMENT === "1";
8798
8846
  return span.child(MANIFEST_TELEMETRY.spanName).trace(async (manifestSpan) => {
8799
8847
  const report = (fields) => reportTelemetry(manifestSpan, MANIFEST_TELEMETRY, {
8800
8848
  mode: modeLabel(enforce),
@@ -9541,35 +9589,10 @@ function moduleColonFuncToCronPath(serviceName, moduleFunction) {
9541
9589
  return (0, import_build_utils13.getInternalServiceCronPath)(serviceName, entrypointPath, funcPart);
9542
9590
  }
9543
9591
 
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
9592
  // src/start-dev-server.ts
9568
9593
  var import_child_process2 = require("child_process");
9569
- var import_crypto2 = require("crypto");
9570
9594
  var import_fs15 = require("fs");
9571
9595
  var import_path15 = require("path");
9572
- var import_util6 = require("util");
9573
9596
  var import_build_utils16 = require("@vercel/build-utils");
9574
9597
  var import_get_port = __toESM(require_get_port());
9575
9598
  var import_is_port_reachable = __toESM(require_is_port_reachable());
@@ -10844,20 +10867,16 @@ async function getMultiServicePythonRunner(workPath, env, systemPython, uvPath)
10844
10867
  env.PATH = `${binDir}${import_path15.delimiter}${env.PATH || ""}`;
10845
10868
  return { command: pythonBin, args: [] };
10846
10869
  }
10847
- async function claimPersistentServer(serverKey, isStale) {
10870
+ async function claimPersistentServer(serverKey) {
10848
10871
  while (true) {
10849
10872
  const existing = PERSISTENT_SERVERS.get(serverKey);
10850
10873
  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
- }
10874
+ return {
10875
+ port: existing.port,
10876
+ pid: existing.pid,
10877
+ shutdown: async () => {
10878
+ }
10879
+ };
10861
10880
  }
10862
10881
  const pending = PENDING_STARTS.get(serverKey);
10863
10882
  if (!pending)
@@ -10889,9 +10908,7 @@ async function spawnPersistentServer({
10889
10908
  port: requestedPort,
10890
10909
  env,
10891
10910
  onStdout,
10892
- onStderr,
10893
- scheduleModule,
10894
- scheduleEnv
10911
+ onStderr
10895
10912
  }) {
10896
10913
  const port = requestedPort ?? await (0, import_get_port.default)();
10897
10914
  env.PORT = `${port}`;
@@ -10963,9 +10980,7 @@ async function spawnPersistentServer({
10963
10980
  pid,
10964
10981
  child,
10965
10982
  stdoutLogListener,
10966
- stderrLogListener,
10967
- scheduleModule,
10968
- scheduleEnv
10983
+ stderrLogListener
10969
10984
  });
10970
10985
  return { port, pid };
10971
10986
  }
@@ -11078,20 +11093,13 @@ var startDevServer = async (opts) => {
11078
11093
  onStderr
11079
11094
  } = opts;
11080
11095
  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
11096
  const env = { ...process.env, ...meta.env || {} };
11085
- const scheduleEnv = scheduleFunction ? { ...env } : void 0;
11086
11097
  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) {
11098
+ const serverKey = serviceName ? `${workPath}::${framework}::${serviceName}` : `${workPath}::${framework}`;
11099
+ if (!framework) {
11089
11100
  return null;
11090
11101
  }
11091
- const start = await claimPersistentServer(
11092
- serverKey,
11093
- (info) => !!scheduleFunction && (info.scheduleModule !== scheduleModule || !(0, import_util6.isDeepStrictEqual)(info.scheduleEnv, scheduleEnv))
11094
- );
11102
+ const start = await claimPersistentServer(serverKey);
11095
11103
  if ("port" in start) {
11096
11104
  return start;
11097
11105
  }
@@ -11105,12 +11113,7 @@ var startDevServer = async (opts) => {
11105
11113
  const handlerFunction = typeof config?.handlerFunction === "string" ? config.handlerFunction : void 0;
11106
11114
  const isPyQueueSidecar = config?.pythonQueueSidecar === "subscriber" || config?.pythonQueueSidecar === "workflow";
11107
11115
  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) {
11116
+ if (isPyprojectEntrypoint) {
11114
11117
  const declaredEntrypoint = await getVercelToolsEntrypoint(
11115
11118
  workPath,
11116
11119
  opts.repoRootPath
@@ -11152,7 +11155,7 @@ var startDevServer = async (opts) => {
11152
11155
  });
11153
11156
  }
11154
11157
  const { entrypoint: entry, variableName } = resolved;
11155
- const modulePath = scheduleHandlerPath ? generatedPythonPathToModule(scheduleHandlerPath) : entrypointToModule(entry);
11158
+ const modulePath = entrypointToModule(entry);
11156
11159
  const { pythonPath: systemPython } = getDefaultPythonVersion(meta);
11157
11160
  const uvPath = await findUvBinary(systemPython);
11158
11161
  if (uvPath) {
@@ -11281,7 +11284,7 @@ If you are using a virtual environment, activate it before running "vercel dev",
11281
11284
  );
11282
11285
  }
11283
11286
  const apschedulerSubscribers = [];
11284
- if (!legacyProject && !scheduleFunction) {
11287
+ if (!legacyProject) {
11285
11288
  const runtimeDir = (0, import_path15.join)(workPath, ".vercel", "python");
11286
11289
  const declaredSubscribers = await getPyprojectSubscribers(workPath);
11287
11290
  const introspectionEnv = {
@@ -11397,8 +11400,8 @@ If you are using a virtual environment, activate it before running "vercel dev",
11397
11400
  workPath,
11398
11401
  entry,
11399
11402
  modulePath,
11400
- shimSubdir: scheduleHandlerPath ? scheduleHandlerPath.replace(/\.py$/, "") : serviceName && import_path15.posix.join("services", serviceName),
11401
- framework: framework ?? "python",
11403
+ shimSubdir: serviceName && import_path15.posix.join("services", serviceName),
11404
+ framework,
11402
11405
  variableName: variableName ?? "",
11403
11406
  extraPythonPath: hookResult?.extraPythonPath,
11404
11407
  spawnCommand,
@@ -11406,9 +11409,7 @@ If you are using a virtual environment, activate it before running "vercel dev",
11406
11409
  port: typeof meta.port === "number" ? meta.port : void 0,
11407
11410
  env,
11408
11411
  onStdout,
11409
- onStderr,
11410
- scheduleModule,
11411
- scheduleEnv
11412
+ onStderr
11412
11413
  });
11413
11414
  start.resolve({ port, pid });
11414
11415
  const shutdown = async () => {
@@ -13126,11 +13127,11 @@ function getTargetPlatform(isDev) {
13126
13127
  }
13127
13128
  return { uvPlatform: UV_LINUX_TARGET, architecture: "x86_64" };
13128
13129
  }
13129
- function getMatchingFunction(config, entrypoint, isScheduleEntrypoint = false) {
13130
+ function getMatchingFunction(config, entrypoint) {
13130
13131
  if (!entrypoint) {
13131
13132
  return;
13132
13133
  }
13133
- const candidates = entrypoint.endsWith(".py") && !isScheduleEntrypoint ? [entrypoint, entrypoint.slice(0, -".py".length)] : [entrypoint];
13134
+ const candidates = entrypoint.endsWith(".py") ? [entrypoint, entrypoint.slice(0, -".py".length)] : [entrypoint];
13134
13135
  return (0, import_build_utils25.findMatchingFunction)(config?.functions, candidates);
13135
13136
  }
13136
13137
  function normalizeGlobs(value) {
@@ -13138,14 +13139,12 @@ function normalizeGlobs(value) {
13138
13139
  }
13139
13140
  async function getPythonLambdaOptions({
13140
13141
  config,
13141
- entrypoint,
13142
- isScheduleEntrypoint = false
13142
+ entrypoint
13143
13143
  }) {
13144
- const match = getMatchingFunction(config, entrypoint, isScheduleEntrypoint);
13144
+ const match = getMatchingFunction(config, entrypoint);
13145
13145
  const lambdaOptions = await (0, import_build_utils25.getLambdaOptionsFromFunction)({
13146
13146
  sourceFile: match?.sourceFile ?? entrypoint,
13147
- config,
13148
- isScheduleEntrypoint
13147
+ config
13149
13148
  });
13150
13149
  delete lambdaOptions.architecture;
13151
13150
  return lambdaOptions;
@@ -13274,7 +13273,7 @@ async function runUvManagedInstall({
13274
13273
  requireBinaryWheels: false,
13275
13274
  cachedLockPath
13276
13275
  });
13277
- const { projectDir, lockPath, lockFileProvidedByUser } = result;
13276
+ const { projectDir, lockPath, lockFileProvidedByUser, workspacePackage } = result;
13278
13277
  if (extraSyncParams !== void 0) {
13279
13278
  if (!lockFileProvidedByUser) {
13280
13279
  await dependencyScanner?.scanGeneratedLockfile({
@@ -13290,6 +13289,7 @@ async function runUvManagedInstall({
13290
13289
  frozen: lockFileProvidedByUser,
13291
13290
  locked: !lockFileProvidedByUser,
13292
13291
  pythonPlatform,
13292
+ workspacePackage,
13293
13293
  ...extraSyncParams
13294
13294
  });
13295
13295
  }
@@ -13305,6 +13305,7 @@ async function packFunctionBundle({
13305
13305
  uvLockPath,
13306
13306
  uvProjectDir,
13307
13307
  projectName,
13308
+ workspacePackage,
13308
13309
  pythonVersion,
13309
13310
  hasCustomCommand,
13310
13311
  alwaysBundlePackages,
@@ -13359,6 +13360,7 @@ async function packFunctionBundle({
13359
13360
  uvLockPath,
13360
13361
  uvProjectDir,
13361
13362
  projectName,
13363
+ workspacePackage,
13362
13364
  pythonVersion,
13363
13365
  hasCustomCommand,
13364
13366
  alwaysBundlePackages
@@ -13695,7 +13697,11 @@ async function buildProxyMiddleware({
13695
13697
  meta
13696
13698
  });
13697
13699
  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, {
13700
+ const {
13701
+ projectDir,
13702
+ lockPath: uvLockPath,
13703
+ workspacePackage
13704
+ } = await builderSpan.child(import_build_utils25.BUILDER_INSTALLER_STEP, {
13699
13705
  runtime: "python",
13700
13706
  "python.cache.restored": restoredCache
13701
13707
  }).trace(async (installSpan) => {
@@ -13760,6 +13766,7 @@ async function buildProxyMiddleware({
13760
13766
  uvLockPath,
13761
13767
  uvProjectDir: projectDir,
13762
13768
  projectName,
13769
+ workspacePackage,
13763
13770
  pythonVersion,
13764
13771
  hasCustomCommand: false,
13765
13772
  alwaysBundlePackages: [],
@@ -13897,8 +13904,6 @@ var build = async ({
13897
13904
  throw err;
13898
13905
  }
13899
13906
  let detected;
13900
- const scheduleFunction = config?.scheduleFunction;
13901
- const scheduleEntrypoint = scheduleFunction?.entrypoints[0];
13902
13907
  const handlerFunction = typeof config?.handlerFunction === "string" ? config.handlerFunction : void 0;
13903
13908
  if (isPyprojectEntrypoint) {
13904
13909
  const declared = await getVercelToolsEntrypoint(workPath, repoRootPath);
@@ -13911,13 +13916,6 @@ var build = async ({
13911
13916
  });
13912
13917
  }
13913
13918
  entrypoint = void 0;
13914
- } else if (scheduleEntrypoint) {
13915
- detected = {
13916
- entrypoint: {
13917
- entrypoint: scheduleEntrypoint.sourceFile,
13918
- variableName: ""
13919
- }
13920
- };
13921
13919
  } else {
13922
13920
  detected = await detectPythonEntrypoint(
13923
13921
  config.framework,
@@ -13981,6 +13979,7 @@ var build = async ({
13981
13979
  let uvLockPath = null;
13982
13980
  let uvProjectDir = null;
13983
13981
  let projectName;
13982
+ let workspacePackage;
13984
13983
  let usedUvManagedInstall = false;
13985
13984
  await builderSpan.child(import_build_utils25.BUILDER_INSTALLER_STEP, {
13986
13985
  installCommand: projectInstallCommand || void 0,
@@ -14022,7 +14021,7 @@ var build = async ({
14022
14021
  }
14023
14022
  }
14024
14023
  if (!assumeDepsInstalled) {
14025
- const { projectDir, lockPath } = await runUvManagedInstall({
14024
+ const installed = await runUvManagedInstall({
14026
14025
  workPath,
14027
14026
  rootDir,
14028
14027
  venvPath,
@@ -14036,8 +14035,9 @@ var build = async ({
14036
14035
  dependencyScanner,
14037
14036
  installSpan
14038
14037
  });
14039
- uvLockPath = lockPath;
14040
- uvProjectDir = projectDir;
14038
+ uvLockPath = installed.lockPath;
14039
+ uvProjectDir = installed.projectDir;
14040
+ workspacePackage = installed.workspacePackage;
14041
14041
  projectName = pythonPackage?.manifest?.data?.project?.name;
14042
14042
  usedUvManagedInstall = true;
14043
14043
  }
@@ -14277,35 +14277,33 @@ var build = async ({
14277
14277
  });
14278
14278
  }
14279
14279
  }
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
- });
14280
+ const moduleName = entrypointToModule(entrypoint);
14281
+ const suffix = meta.isDev && !entrypoint.endsWith(".py") ? ".py" : "";
14282
+ const entrypointWithSuffix = `${entrypoint}${suffix}`;
14283
+ (0, import_build_utils25.debug)("Entrypoint with suffix is", entrypointWithSuffix);
14284
+ crons = await getServiceCrons({
14285
+ service,
14286
+ entrypoint,
14287
+ rawEntrypoint,
14288
+ handlerFunction,
14289
+ pythonBin: getVenvPythonBin(venvPath),
14290
+ env: pythonEnv,
14291
+ workPath
14292
+ });
14293
+ const extraTrampolineEnv = [];
14294
+ if (crons?.length) {
14295
+ const json = JSON.stringify(buildCronRouteTable(crons));
14296
+ (0, import_assert.default)(!json.includes("\\"), `backslash in cron route table: ${json}`);
14297
+ extraTrampolineEnv.push(`"__VC_CRON_ROUTES": '${json}'`);
14308
14298
  }
14299
+ const variableName = resolved?.variableName ?? "";
14300
+ runtimeTrampoline = createRuntimeTrampoline({
14301
+ moduleName,
14302
+ entrypoint: entrypointWithSuffix,
14303
+ vendorDir,
14304
+ variableName,
14305
+ extraEnv: extraTrampolineEnv
14306
+ });
14309
14307
  }
14310
14308
  const compileAllEnabled = shouldCompileAll({
14311
14309
  isDev: meta.isDev,
@@ -14340,8 +14338,7 @@ var build = async ({
14340
14338
  }
14341
14339
  const functionConfig = getMatchingFunction(
14342
14340
  config,
14343
- entrypoint,
14344
- scheduleEntrypoint !== void 0
14341
+ entrypoint
14345
14342
  )?.functionConfig;
14346
14343
  const includeFilesPatterns = [
14347
14344
  ...normalizeGlobs(config?.includeFiles),
@@ -14377,6 +14374,7 @@ var build = async ({
14377
14374
  uvLockPath,
14378
14375
  uvProjectDir,
14379
14376
  projectName,
14377
+ workspacePackage,
14380
14378
  pythonVersion,
14381
14379
  hasCustomCommand,
14382
14380
  alwaysBundlePackages: [
@@ -14592,42 +14590,6 @@ var build = async ({
14592
14590
  );
14593
14591
  }
14594
14592
  }
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
14593
  if (!(0, import_build_utils25.isPythonFramework)(framework) && !service?.name && !isPyprojectEntrypoint) {
14632
14594
  (0, import_assert.default)(output, "web Lambda must exist for non-service builds");
14633
14595
  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-579f9b2619d8",
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-579f9b2619d8"
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/python-runtime": "0.24.3",
42
+ "@vercel/build-utils": "15.4.0-snapshot-579f9b2619d8"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "node ../../utils/build-builder.mjs",