You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know I can use shebang but this syntax makes more sense and would be cleaner especially when files are referenced or python -m <module_name> <arguments> are provided without resorting to @shell or @duckscript.
Code Sample
[config]
skip_core_tasks = true
[env]
VENV_DIR = "/tmp/venvs"UV_DIR = "/tmp/venvs"VENV_NAME = "venv"
[tasks.default]
clear = truecommand = "echo"args = ["default task"]
dependencies = ["pythontask"]
[tasks.venv]
script_runner = "@duckscript"script = '''if not is_file ${VENV_DIR}/${VENV_NAME} if is_windows # TODO: uv supports Windows, should be easy to impl here. else if not is_file ${UV_DIR}/uv/bin/uv if not is_file uv-installer.sh exec curl --proto "=https" --tlsv1.2 -OLsSf https://github.com/astral-sh/uv/releases/download/0.2.29/uv-installer.sh end exec env -i CARGO_HOME=${UV_DIR}/uv HOME=${UV_DIR}/uv /usr/bin/bash uv-installer.sh --no-modify-path rm uv-installer.sh end exec ${UV_DIR}/uv/bin/uv venv ${VENV_DIR}/${VENV_NAME} if is_file requirements.txt exec env -i PATH=${VENV_DIR}/${VENV_NAME}/bin ${UV_DIR}/uv/bin/uv pip install -r requirements.txt end endend'''
[tasks.pythontask]
script_runner = "${VENV_DIR}/${VENV_NAME}/bin/python"script_extension = "py"script = '''import sys# import pip; print(pip.__path__)print(sys.executable, "\n", sys.version, sep="")print("Python task running in Python")'''dependencies = ["venv"]
[cargo-make] INFO - Running Task: pythontask
[cargo-make] INFO - Execute Command: "${VENV_DIR}/${VENV_NAME}/bin/python" "/tmp/fsio_WYhdLBybEa.py"
[cargo-make] ERROR - Unable to execute script.
PS: To elaborate the idea, here's an example of executing a file that does work, but a script_runner variant makes more sense semantically IMHO:
Feature Description
Can
script_runner
evaluate its variables?Describe The Solution You'd Like
I know I can use shebang but this syntax makes more sense and would be cleaner especially when files are referenced or
python -m <module_name> <arguments>
are provided without resorting to@shell
or@duckscript
.Code Sample
PS: To elaborate the idea, here's an example of executing a file that does work, but a
script_runner
variant makes more sense semantically IMHO:The text was updated successfully, but these errors were encountered: