mirror of
https://github.com/n8n-io/n8n-docs.git
synced 2026-03-27 09:28:43 +07:00
docs: Mark native Python as stable (#3972)
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> Co-authored-by: Kartik Balasubramanian <22399046+HumanistSerif@users.noreply.github.com>
This commit is contained in:
@@ -58,7 +58,7 @@ The Code node editing environment supports time-saving and useful keyboard short
|
||||
|
||||
## Python (Pyodide - legacy)
|
||||
|
||||
Pyodide is a legacy feature. Future versions of n8n will no longer support this feature.
|
||||
Pyodide is a legacy feature. n8n v2 no longer supports this feature.
|
||||
|
||||
n8n added Python support in version 1.0. It doesn't include a Python executable. Instead, n8n provides Python support using [Pyodide](https://pyodide.org/en/stable/), which is a port of CPython to WebAssembly. This limits the available Python packages to the [Packages included with Pyodide](https://pyodide.org/en/stable/usage/packages-in-pyodide.html#packages-in-pyodide). n8n downloads the package automatically the first time you use it.
|
||||
|
||||
@@ -82,9 +82,9 @@ You can't access the file system or make HTTP requests. Use the following nodes
|
||||
* [Read/Write File From Disk](/integrations/builtin/core-nodes/n8n-nodes-base.readwritefile.md)
|
||||
* [HTTP Request](/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/index.md)
|
||||
|
||||
## Python (Native - beta)
|
||||
## Python (Native)
|
||||
|
||||
n8n added native Python support using task runners (beta) in version 1.111.0.
|
||||
n8n added native Python support using task runners in version 1.111.0. This feature is stable as of n8n v2.
|
||||
|
||||
Main differences from Pyodide:
|
||||
|
||||
@@ -93,9 +93,7 @@ Main differences from Pyodide:
|
||||
- Native Python denies insecure built-ins by default. See [task runners environment variables](/hosting/configuration/environment-variables/task-runners.md) for more details.
|
||||
- Unlike Pyodide, which accepts dot access notation, for example, `item.json.myNewField`, native Python only accepts bracket access notation, for example, `item["json"]["my_new_field"]`. There may be other minor syntax differences where Pyodide accepts constructs that aren't legal in native Python.
|
||||
|
||||
Keep in mind upgrading to native Python is a breaking change, so you may need to adjust your Python scripts to use the native Python runner.
|
||||
|
||||
This feature is in beta and is subject to change. As it becomes stable, n8n will roll it out progressively to n8n cloud users during 2025. Self-hosting users can [try it out](/hosting/configuration/task-runners.md) and provide feedback.
|
||||
Upgrading to native Python is a breaking change, so you may need to adjust your Python scripts to use the native Python runner.
|
||||
|
||||
## Coding in n8n
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ Starting with v2.0, the main `n8nio/n8n` Docker image will no longer include the
|
||||
|
||||
n8n will remove the Pyodide-based Python Code node and tool and replace them with a [task runner-based](/hosting/configuration/task-runners.md) implementation that uses native Python for better security and performance. Starting in v2.0, you can only use Python Code nodes with task runners in [external mode](/hosting/configuration/task-runners.md#external-mode) and native Python tools.
|
||||
|
||||
The native Python Code node doesn't support built-in variables like `_input` or dot access notation, which were available in the Pyodide-based version. For details, see the [Code node documentation](/integrations/builtin/core-nodes/n8n-nodes-base.code/index.md#python-native-beta).
|
||||
The native Python Code node doesn't support built-in variables like `_input` or dot access notation, which were available in the Pyodide-based version. For details, see the [Code node documentation](/integrations/builtin/core-nodes/n8n-nodes-base.code/index.md#python-native).
|
||||
|
||||
The native Python tool supports `_query` for the input string that the AI Agent passes to the tool when it calls it.
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ You can use Python in the Code node. It isn't available in expressions.
|
||||
| `$workflow.active` | Whether the workflow is active (true) or not (false). | :white_check_mark: |
|
||||
| `$workflow.id` | The workflow ID. | :white_check_mark: |
|
||||
| `$workflow.name` | The workflow name. | :white_check_mark: |
|
||||
=== "Python (native, beta)"
|
||||
=== "Python (native)"
|
||||
| Method | Description |
|
||||
| ------ | ----------- |
|
||||
| `_items` | Contains incoming items in "Run once for all items" mode. |
|
||||
|
||||
@@ -8,10 +8,6 @@ contentType: howto
|
||||
|
||||
Task runners are a generic mechanism to execute tasks in a secure and performant way. They're used to execute user-provided JavaScript and Python code in the [Code node](/integrations/builtin/core-nodes/n8n-nodes-base.code/index.md).
|
||||
|
||||
/// note | In beta
|
||||
Task runner support for native Python and the `n8nio/runners` image are in beta. Until this feature is stable, you must use the `N8N_NATIVE_PYTHON_RUNNER=true` environment variable to enable the Python runner.
|
||||
///
|
||||
|
||||
This document describes how task runners work and how you can configure them.
|
||||
|
||||
## How it works
|
||||
@@ -79,6 +75,8 @@ volumes:
|
||||
n8n_data:
|
||||
```
|
||||
|
||||
There are three layers of configuration: the n8n container, the runners container, and the launcher inside the runners container.
|
||||
|
||||
### Configuring n8n container in external mode
|
||||
|
||||
These are the main environment variables that you can set on the n8n container running in external mode:
|
||||
@@ -106,14 +104,19 @@ For full list of environment variables see [task runner environment variables](/
|
||||
|
||||
### Configuring launcher in runners container in external mode
|
||||
|
||||
The launcher will read environment variables from runners container environment, and will pass them along to each runner as defined in the [default launcher configuration file](https://github.com/n8n-io/n8n/blob/master/docker/images/runners/n8n-task-runners.json), located in the container at `/etc/task-runners.json`. The default launcher configuration file is locked down, but you will likely want to edit this file, for example, to allowlist first- or third-party modules. To customize the launcher configuration file, mount to this path:
|
||||
The launcher reads environment variables from runners container environment, and performs the following actions:
|
||||
|
||||
* Passing environment variables from the launcher's own environment to all runners (`allowed-env`)
|
||||
* Setting specific environment variables on specific runners (`env-overrides`)
|
||||
|
||||
Which environment variables to pass and to set are defined in the [launcher config file](https://github.com/n8n-io/n8n/blob/master/docker/images/runners/n8n-task-runners.json) included in the runners image. This config file is located in the container at `/etc/task-runners.json`. To learn more about the launcher config file, refer to the [Config file documentation](https://github.com/n8n-io/task-runner-launcher/blob/main/docs/setup.md#config-file).
|
||||
|
||||
The default launcher configuration file is locked down, but you can edit this file, for example, to allowlist first- or third-party modules. To customize the launcher configuration file, mount to this path:
|
||||
|
||||
```
|
||||
path/to/n8n-task-runners.json:/etc/n8n-task-runners.json
|
||||
```
|
||||
|
||||
For further information about the launcher config file, see [here](https://github.com/n8n-io/task-runner-launcher/blob/main/docs/setup.md#config-file).
|
||||
|
||||
## Adding extra dependencies
|
||||
|
||||
### 1. Extend the `n8nio/runners` image
|
||||
@@ -158,10 +161,6 @@ You must also allowlist any first-party or third-party packages for use by the C
|
||||
* `N8N_RUNNERS_STDLIB_ALLOW`: comma-separated list of allowed Python standard library packages.
|
||||
* `N8N_RUNNERS_EXTERNAL_ALLOW`: comma-separated list of allowed Python packages.
|
||||
|
||||
#### Multiple runners and the port for the runner's health check server
|
||||
|
||||
When a single runner is configured, the *"health-check-server-port"* field found in the `n8n-task-runners.json` configuration file is optional and defaults to 5681. When multiple runners are configured, this is required and must be unique per runner. Refer to the launcher’s [config file documentation](https://github.com/n8n-io/task-runner-launcher/blob/main/docs/setup.md#config-file) for the full list of options and examples.
|
||||
|
||||
### 2. Build your custom image
|
||||
|
||||
For example, from the n8n repository root:
|
||||
|
||||
Reference in New Issue
Block a user