@vercel/python 6.0.5 → 6.0.7

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.
package/dist/index.js CHANGED
@@ -3414,7 +3414,6 @@ async function detectPythonEntrypoint(framework, workPath, configuredEntrypoint)
3414
3414
  // src/utils.ts
3415
3415
  var import_fs3 = __toESM(require("fs"));
3416
3416
  var import_path3 = require("path");
3417
- var import_execa2 = __toESM(require_execa());
3418
3417
  var import_build_utils5 = require("@vercel/build-utils");
3419
3418
  var isInVirtualEnv = () => {
3420
3419
  return process.env.VIRTUAL_ENV;
@@ -3454,27 +3453,12 @@ async function runPyprojectScript(workPath, scriptNames, env) {
3454
3453
  return false;
3455
3454
  const systemPython = process.platform === "win32" ? "python" : "python3";
3456
3455
  const finalEnv = { ...process.env, ...env };
3457
- const { pythonCmd } = useVirtualEnv(workPath, finalEnv, systemPython);
3458
- const uvPath = await getUvBinaryOrInstall(pythonCmd);
3456
+ useVirtualEnv(workPath, finalEnv, systemPython);
3459
3457
  const scriptCommand = scripts[scriptToRun];
3460
3458
  if (typeof scriptCommand === "string" && scriptCommand.trim()) {
3461
- const uvDir = (0, import_path3.dirname)(uvPath);
3462
- finalEnv.PATH = `${uvDir}${import_path3.delimiter}${finalEnv.PATH || ""}`;
3463
- if (/^\s*uv(\s|$)/i.test(scriptCommand)) {
3464
- console.log(`Executing: ${scriptCommand}`);
3465
- await (0, import_build_utils5.execCommand)(scriptCommand, {
3466
- cwd: workPath,
3467
- env: finalEnv
3468
- });
3469
- return true;
3470
- }
3471
- const args = process.platform === "win32" ? ["run", "cmd", "/d", "/s", "/c", scriptCommand] : ["run", "sh", "-lc", scriptCommand];
3472
- console.log(
3473
- `Executing: ${uvPath} ${args.map((a) => /\s/.test(a) ? `"${a.replace(/"/g, '\\"')}"` : a).join(" ")}`
3474
- );
3475
- await (0, import_execa2.default)(uvPath, args, {
3459
+ console.log(`Executing: ${scriptCommand}`);
3460
+ await (0, import_build_utils5.execCommand)(scriptCommand, {
3476
3461
  cwd: workPath,
3477
- stdio: "inherit",
3478
3462
  env: finalEnv
3479
3463
  });
3480
3464
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/python",
3
- "version": "6.0.5",
3
+ "version": "6.0.7",
4
4
  "main": "./dist/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
@@ -21,7 +21,7 @@
21
21
  "@types/jest": "27.4.1",
22
22
  "@types/node": "14.18.33",
23
23
  "@types/which": "3.0.0",
24
- "@vercel/build-utils": "13.0.1",
24
+ "@vercel/build-utils": "13.1.1",
25
25
  "cross-env": "7.0.3",
26
26
  "execa": "^1.0.0",
27
27
  "fs-extra": "11.1.1",
package/vc_init.py CHANGED
@@ -19,6 +19,7 @@ import builtins
19
19
  from typing import Callable, Literal, TextIO
20
20
  import contextvars
21
21
  import contextlib
22
+ import atexit
22
23
 
23
24
 
24
25
  _here = os.path.dirname(__file__)
@@ -198,6 +199,30 @@ def enqueue_or_send_message(msg: dict):
198
199
  _original_stderr.write(decoded + "\n")
199
200
 
200
201
 
202
+ def flush_init_log_buf_to_stderr():
203
+ global _init_log_buf, _init_log_buf_bytes
204
+ try:
205
+ combined: list[str] = []
206
+ for m in _init_log_buf:
207
+ payload = m.get("payload", {})
208
+ msg = payload.get("message")
209
+ if not msg:
210
+ continue
211
+ with contextlib.suppress(Exception):
212
+ decoded = base64.b64decode(msg).decode(errors="ignore")
213
+ combined.append(decoded)
214
+ if combined:
215
+ _stderr("".join(combined))
216
+ except Exception:
217
+ pass
218
+ finally:
219
+ _init_log_buf.clear()
220
+ _init_log_buf_bytes = 0
221
+
222
+
223
+ atexit.register(flush_init_log_buf_to_stderr)
224
+
225
+
201
226
  if 'VERCEL_IPC_PATH' in os.environ:
202
227
  with contextlib.suppress(Exception):
203
228
  ipc_sock.connect(os.getenv("VERCEL_IPC_PATH", ""))