|
1 |
| -# n8n - docker image with Python 3.10 |
| 1 | +# n8n - docker image with Python 3.10 and custom node PythonFunction |
2 | 2 |
|
3 | 3 | 
|
4 | 4 |
|
| 5 | +This [image](https://hub.docker.com/r/naskio/n8n-python) includes Python 3.10 by default. it can be used to run python |
| 6 | +scripts inside n8n using the [Execute Command](https://docs.n8n.io/nodes/n8n-nodes-base.executeCommand/) node or code |
| 7 | +snippets using the custom node [Python Function](https://www.github.com/naskio/n8n-nodes-python). |
| 8 | + |
5 | 9 | > Run python 3.10 code on n8n.
|
6 | 10 |
|
7 | 11 | [Docker Hub](https://hub.docker.com/r/naskio/n8n-python)
|
8 | 12 |
|
9 | 13 | [GitHub repository](https://www.github.com/naskio/docker-n8n-python)
|
10 | 14 |
|
11 |
| -n8n is an extendable workflow automation tool. With a [fair-code](http://faircode.io) distribution model, n8n will |
12 |
| -always have visible source code, be available to self-host, and allow you to add your own custom functions, logic and |
13 |
| -apps. n8n's node-based approach makes it highly versatile, enabling you to connect anything to everything. |
14 |
| - |
15 |
| -This [image](https://hub.docker.com/r/naskio/n8n-python) includes Python 3.10 by default. it can be used to run python |
16 |
| -code using the [Execute Command](https://docs.n8n.io/nodes/n8n-nodes-base.executeCommand/) node. |
17 |
| - |
18 |
| -## Example |
| 15 | +## Image Setup |
19 | 16 |
|
20 | 17 | Using docker compose
|
21 | 18 | [docker-compose.yml](./demo/docker-compose-local.yml)
|
22 | 19 |
|
| 20 | +## Usage |
| 21 | + |
| 22 | +### Run Python Code |
| 23 | + |
| 24 | +The image includes the custom module [n8n-nodes-python](https://www.github.com/naskio/n8n-nodes-python) by default. |
| 25 | + |
| 26 | +We can use this custom node [Python Function](https://www.github.com/naskio/n8n-nodes-python) to run a python code over |
| 27 | +the `items` (works the same way as [Function](https://docs.n8n.io/nodes/n8n-nodes-base.function) node) |
| 28 | + |
| 29 | +[Python Function node docs](https://www.github.com/naskio/n8n-nodes-python) |
| 30 | + |
| 31 | +### Run mounted Python scripts using the ExecuteCommand node |
| 32 | + |
| 33 | +You can run `*.py`files that has been mounted to the container using |
| 34 | +the [ExecuteCommand](https://docs.n8n.io/nodes/n8n-nodes-base.executeCommand/) node. |
| 35 | + |
| 36 | +### Installing external packages |
| 37 | + |
| 38 | +The [ExecuteCommand](https://docs.n8n.io/nodes/n8n-nodes-base.executeCommand/) node can be used to install python |
| 39 | +packages or install dependencies from a mounted `requirements.txt` file to the container. |
| 40 | + |
| 41 | +It can be combined with [n8nTrigger](https://docs.n8n.io/nodes/n8n-nodes-base.n8nTrigger) to install packages directly |
| 42 | +after starting the container. |
| 43 | + |
| 44 | +> Once the packages are installed, it can be used in the Python Function node. `import <package>` |
| 45 | +
|
23 | 46 | ## Documentation
|
24 | 47 |
|
25 | 48 | The official n8n documentation can be found under: [https://docs.n8n.io](https://docs.n8n.io)
|
|
0 commit comments