Python
The official Python plugin adds a Python step type to jobs. A step runs Python code, on 3.12 or another version you choose, takes the results of earlier steps and returns rows like any other step. pandas is ready by default, and you can add any package from PyPI.
The plugin needs QueryLane 1.4.0 or later and asks for Network access, Downloads components, Runs programs and User files. It works on Macs with Apple silicon or Intel and on Windows on x64 or Arm.
Install the plugin
- Open Settings > Plugins and install Python. See Using plugins.
- Wait while the status shows Installing components and Getting ready. The plugin installs Python 3.12 and pandas into the plugin folder, so you do not need Python on your computer.
Downloads go through the proxy chosen in Settings > Updates > Proxy mode.
Write a step
- In the job editor, add a step and choose Python as its type.
- Write the code. It is the body of a function: the value you
returnbecomes the rows of the step. - Run the step or the job.
${step_<id>} gives the result of an earlier step, a list of dicts for a table, and makes that step a dependency, so it runs first. ${name} gives the value of the job variable name. References inside # comments stay as text. df(rows) turns rows into a pandas DataFrame.
import pandas as pd
orders = df(${step_orders})
orders["created_at"] = pd.to_datetime(orders["created_at"])
revenue = (
orders.groupby(orders["created_at"].dt.to_period("M").astype(str))["amount"]
.sum()
.rename("revenue")
)
return revenueWhat a step returns
- A list of dicts becomes a table, one dict per row.
- A DataFrame becomes rows by record. A named index, such as the one
groupbyleaves, becomes columns. - A dict becomes one row, other values one value, and
Noneno rows. - Decimals stay exact text, dates and times become ISO text, and NaN becomes empty.
The output of print() is saved with the run as a text file. Files the code writes into ARTIFACTS_DIR, or into its working folder, and matplotlib figures it leaves open also appear under Artifacts in the run history; images show as pictures. See Runs and artifacts.
When the code fails, the step shows the error with the line of your code where it happened.
Packages and Python versions
On the plugin page, Python version chooses the Python of the steps, from 3.10 to 3.14, 3.12 by default. Packages lists their packages, pandas by default. Add a name, such as numpy, or a pinned version, such as requests==2.32.3.
To give some steps another version or other packages, create a preset with them and pick it in those steps under Plugin preset. See Settings and presets. Every version and package list gets its own environment: it installs on its first run, through the same proxy as the plugin, and switching between presets reinstalls nothing. Environments unused the longest are removed when there are more than eight.
How steps run
Every run starts its own Python process, so a run never sees what an earlier one left in memory. A step stops when it reaches its time limit or when you stop the run, and the process ends with it.
The code runs on your computer with your access to files and the network, like a JavaScript step. Agents connected over MCP can run Python steps only while Agents may run code is on in Settings > CLI and MCP. The assistant knows how to write Python steps.