Skip to content

Commit 00c699b

Browse files
authored
fix: replace conda with uv (#269)
closes #113
1 parent d4065a6 commit 00c699b

File tree

1 file changed

+15
-7
lines changed
  • plugin-script-python/src/main/java/io/kestra/plugin/scripts/python

1 file changed

+15
-7
lines changed

plugin-script-python/src/main/java/io/kestra/plugin/scripts/python/Commands.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@
3434
@Example(
3535
full = true,
3636
title = """
37-
Execute a Python script in a Conda virtual environment. First, add the following script in the embedded Code Editor and name it `etl_script.py`:
37+
Execute a Python script in a uv virtual environment. First, add the following script as a Namespace File in the embedded Code Editor and name it `etl_script.py`:
3838
3939
```python
4040
import argparse
41+
import requests
4142
4243
parser = argparse.ArgumentParser()
4344
@@ -46,15 +47,21 @@
4647
args = parser.parse_args()
4748
result = args.num * 2
4849
print(result)
50+
print(f"Requests version: {requests.__version__}")
4951
```
5052
51-
Then, make sure to set the `enabled` flag of the `namespaceFiles` property to `true` to enable [namespace files](https://kestra.io/docs/developer-guide/namespace-files). By default, setting to `true` injects all Namespace files; we `include` only the `etl_script.py` file as that is the only file we require from namespace files.
53+
Then, make sure to set the `enabled` flag of the `namespaceFiles` property to `true` to enable [namespace files](https://kestra.io/docs/concepts/namespace-files). By default, setting this to `true` injects all Namespace files; we `include` only the `etl_script.py` file as that is the only file we need for this task.
5254
53-
This flow uses a `io.kestra.plugin.core.runner.Process` Task Runner and Conda virtual environment for process isolation and dependency management. However, note that, by default, Kestra runs tasks in a Docker container (i.e. a Docker task runner), and you can use the `taskRunner` property to customize many options, as well as `containerImage` to choose the Docker image to use.
55+
This flow uses a `io.kestra.plugin.core.runner.Process` Task Runner and a virtual environment for process isolation and dependency management. However, note that, by default, Kestra runs tasks in a Docker container (i.e. a Docker Task Runner), and you can use the `taskRunner` property to customize many options, as well as `containerImage` to choose the Docker image to use.
5456
""",
5557
code = """
5658
id: python_venv
5759
namespace: company.team
60+
61+
inputs:
62+
- id: nr
63+
type: INT
64+
defaults: 21
5865
5966
tasks:
6067
- id: python
@@ -66,9 +73,10 @@
6673
taskRunner:
6774
type: io.kestra.plugin.core.runner.Process
6875
beforeCommands:
69-
- conda activate myCondaEnv
76+
- uv venv --python 3.13
77+
- uv pip install requests
7078
commands:
71-
- python etl_script.py
79+
- python etl_script.py --num {{inputs.nr}}
7280
"""
7381
),
7482
@Example(
@@ -128,7 +136,7 @@
128136
),
129137
@Example(
130138
full = true,
131-
title = "Run a Python command that can takes an input using an environment variable",
139+
title = "Run a Python command that takes an environment variable as input",
132140
code = """
133141
id: python_input_as_env_variable
134142
namespace: company.team
@@ -248,7 +256,7 @@
248256
),
249257
@Example(
250258
full = true,
251-
title = "Create a python script and execute it in a virtual environment",
259+
title = "Create a Python script and execute it in a venv virtual environment",
252260
code = """
253261
id: script_in_venv
254262
namespace: company.team

0 commit comments

Comments
 (0)