448443a024
Bumps the internal/toolchain Node version to the latest 22.x LTS (`22.23.1`) and standardises it across the repo. Scope is the **platform toolchain + the repo's own runtime images** (all `20 → 22` *upgrades*, off the now-EOL node 20). ### Main changes - Node `20.20.2 → 22.23.1` across all CI workflows, `.nvmrc`, `CONTRIBUTING.md`, and the OSS `docker/Dockerfile` (digest-pinned). - `@types/node → 22.20.0` (root dep + pnpm `overrides`, so the whole workspace resolves to it); lockfile regenerated. - `sdk-compat` matrix: adds Node 24 + 26 (keeps 20, still in `engines`). - **App runtime images → node 22** (were on EOL node 20): `apps/coordinator` → `node:22.23.1-bookworm-slim`; `apps/docker-provider` + `apps/kubernetes-provider` → `node:22-alpine` (reusing the exact digest `apps/supervisor` already runs, so all four worker images are now identical). Stage aliases renamed off `node-20`. ### Possible issues / test notes - `@types/node` 22.x can surface new TS errors — typecheck (now on 22) is the gate. - **Smoke-test the v3 worker path** — `coordinator` (`crictl`/CRI calls) and the docker/kubernetes providers (talking to their daemons) now run on node 22 (alpine/musl for the providers). Upgrade off EOL so low-risk, but it's deployed runtime code with its own `publish-worker.yml` pipeline.
Python Extension for Trigger.dev
The Python extension enhances Trigger.dev's build process by enabling limited support for executing Python scripts within your tasks.
Overview
This extension introduces the pythonExtension build extension, which offers several key capabilities:
- Install Python Dependencies (Except in Dev): Automatically installs Python and specified dependencies using
pip. - Requirements File Support: You can specify dependencies in a
requirements.txtfile. - Inline Requirements: Define dependencies directly within your
trigger.config.tsfile using therequirementsoption. - Virtual Environment: Creates a virtual environment (
/opt/venv) inside containers to isolate Python dependencies. - Helper Functions: Provides a variety of functions for executing Python code:
run: Executes Python commands with proper environment setup.runInline: Executes inline Python code directly from Node.runScript: Executes standalone.pyscript files.
- Custom Python Path: In development, you can configure
devPythonBinaryPathto point to a custom Python installation.
Usage
- Add the extension to your
trigger.config.tsfile:
import { defineConfig } from "@trigger.dev/sdk/v3";
import { pythonExtension } from "@trigger.dev/python/extension";
export default defineConfig({
project: "<project ref>",
build: {
extensions: [
pythonExtension({
requirementsFile: "./requirements.txt", // Optional: Path to your requirements file
devPythonBinaryPath: ".venv/bin/python", // Optional: Custom Python binary path
scripts: ["src/python/**/*.py"], // Glob pattern for Python scripts
}),
],
},
});
- (Optional) Create a
requirements.txtfile in your project root with the necessary Python dependencies.
pandas==1.3.3
numpy==1.21.2
import { defineConfig } from "@trigger.dev/sdk/v3";
import { pythonExtension } from "@trigger.dev/python/extension";
export default defineConfig({
project: "<project ref>",
build: {
extensions: [
pythonExtension({
requirementsFile: "./requirements.txt",
}),
],
},
});
- Execute Python scripts within your tasks using one of the provided functions:
Running a Python Script
import { task } from "@trigger.dev/sdk/v3";
import { python } from "@trigger.dev/python";
export const myScript = task({
id: "my-python-script",
run: async () => {
const result = await python.runScript("my_script.py", ["hello", "world"]);
return result.stdout;
},
});
export const myStreamingScript = task({
id: "my-streaming-python-script",
run: async () => {
// You can also stream the output of the script
const result = python.stream.runScript("my_script.py", ["hello", "world"]);
// result is an async iterable/readable stream
for await (const chunk of streamingResult) {
logger.debug("convert-url-to-markdown", {
url: payload.url,
chunk,
});
}
},
});
Running Inline Python Code
import { task } from "@trigger.dev/sdk/v3";
import { python } from "@trigger.dev/python";
export const myTask = task({
id: "to_datetime-task",
run: async () => {
const result = await python.runInline(`
import pandas as pd
pd.to_datetime("${+new Date() / 1000}")
`);
return result.stdout;
},
});
Running Lower-Level Commands
import { task } from "@trigger.dev/sdk/v3";
import { python } from "@trigger.dev/python";
export const pythonVersionTask = task({
id: "python-version-task",
run: async () => {
const result = await python.run(["--version"]);
return result.stdout; // Expected output: Python 3.12.8
},
});
Limitations
- This is a partial implementation and does not provide full Python support as an execution runtime for tasks.
- Manual intervention may be required for installing and configuring binary dependencies in development environments.
Additional Information
For more detailed documentation, visit the official docs at Trigger.dev Documentation.