From 9aa1ddcf517e2f0ba5db755872047a470db7d5e1 Mon Sep 17 00:00:00 2001 From: "pengshixin.psx" Date: Thu, 29 Jan 2026 03:30:55 +0000 Subject: [PATCH 1/2] docs: add instructions for accelerating Python installation in docs --- .../Python SDK References/runtime-env.md | 29 ++++++++++++++++++- .../Python SDK References/runtime-env.md | 29 ++++++++++++++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/docs/i18n/zh-Hans/docusaurus-plugin-content-docs/version-1.1.x/References/Python SDK References/runtime-env.md b/docs/i18n/zh-Hans/docusaurus-plugin-content-docs/version-1.1.x/References/Python SDK References/runtime-env.md index 9194a019e..ca06e73d1 100644 --- a/docs/i18n/zh-Hans/docusaurus-plugin-content-docs/version-1.1.x/References/Python SDK References/runtime-env.md +++ b/docs/i18n/zh-Hans/docusaurus-plugin-content-docs/version-1.1.x/References/Python SDK References/runtime-env.md @@ -103,4 +103,31 @@ class NodeRuntimeEnv(RuntimeEnv): "tar -xf node.tar.xz && " "mv node-v22.18.0-linux-x64 runtime-env" ) -``` \ No newline at end of file +``` + +## 加速基础环境安装 + +`PythonRuntimeEnv` 默认从 下载 Python 安装包。若网络不可达或下载较慢,可通过环境变量 `ROCK_RTENV_PYTHON_V31114_INSTALL_CMD` 或 `ROCK_RTENV_PYTHON_V31212_INSTALL_CMD` 覆盖默认安装命令(例如切换到内网源/镜像源)。 + +默认值示例: + +```python +"ROCK_RTENV_PYTHON_V31114_INSTALL_CMD": lambda: os.getenv( + "ROCK_RTENV_PYTHON_V31114_INSTALL_CMD", + "[ -f cpython31114.tar.gz ] && rm cpython31114.tar.gz; [ -d python ] && rm -rf python; " + "wget -q -O cpython31114.tar.gz https://github.com/astral-sh/python-build-standalone/releases/download/20251120/cpython-3.11.14+20251120-x86_64-unknown-linux-gnu-install_only.tar.gz " + "&& tar -xzf cpython31114.tar.gz && mv python runtime-env", +), +``` + +例如,替换为镜像源下载: + +```bash +export ROCK_RTENV_PYTHON_V31114_INSTALL_CMD='[ -f cpython31114.tar.gz ] && rm cpython31114.tar.gz; [ -d python ] && rm -rf python; wget -q -O cpython31114.tar.gz https://mirror.nju.edu.cn/github-release/astral-sh/python-build-standalone/20251209/cpython-3.11.14+20251209-x86_64-unknown-linux-gnu-install_only.tar.gz && tar -xzf cpython31114.tar.gz && mv python runtime-env' +``` + +请确保该命令执行完成后,会在 `runtime_env` 的默认工作目录下生成 `runtime-env` 目录,并且 `${workdir}/runtime-env/bin/` 下包含对应可执行文件,例如: + +- `${workdir}/runtime-env/bin/python` + +Node 环境同理,可通过修改环境变量 `ROCK_RTENV_NODE_V22180_INSTALL_CMD` 来指定更快的下载/安装命令。 \ No newline at end of file diff --git a/docs/versioned_docs/version-1.1.x/References/Python SDK References/runtime-env.md b/docs/versioned_docs/version-1.1.x/References/Python SDK References/runtime-env.md index 914bde276..d1940307d 100644 --- a/docs/versioned_docs/version-1.1.x/References/Python SDK References/runtime-env.md +++ b/docs/versioned_docs/version-1.1.x/References/Python SDK References/runtime-env.md @@ -102,4 +102,31 @@ class NodeRuntimeEnv(RuntimeEnv): "tar -xf node.tar.xz && " "mv node-v22.18.0-linux-x64 runtime-env" ) -``` \ No newline at end of file +``` + +## Speeding Up Base Runtime Installation + +`PythonRuntimeEnv` downloads Python packages from by default. If the network is unavailable or slow, you can override the default install command via `ROCK_RTENV_PYTHON_V31114_INSTALL_CMD` or `ROCK_RTENV_PYTHON_V31212_INSTALL_CMD` (e.g., switch to an internal registry or a mirror). + +Default value example: + +```python +"ROCK_RTENV_PYTHON_V31114_INSTALL_CMD": lambda: os.getenv( + "ROCK_RTENV_PYTHON_V31114_INSTALL_CMD", + "[ -f cpython31114.tar.gz ] && rm cpython31114.tar.gz; [ -d python ] && rm -rf python; " + "wget -q -O cpython31114.tar.gz https://github.com/astral-sh/python-build-standalone/releases/download/20251120/cpython-3.11.14+20251120-x86_64-unknown-linux-gnu-install_only.tar.gz " + "&& tar -xzf cpython31114.tar.gz && mv python runtime-env", +), +``` + +For example, override it to download from a mirror: + +```bash +export ROCK_RTENV_PYTHON_V31114_INSTALL_CMD='[ -f cpython31114.tar.gz ] && rm cpython31114.tar.gz; [ -d python ] && rm -rf python; wget -q -O cpython31114.tar.gz https://mirror.nju.edu.cn/github-release/astral-sh/python-build-standalone/20251209/cpython-3.11.14+20251209-x86_64-unknown-linux-gnu-install_only.tar.gz && tar -xzf cpython31114.tar.gz && mv python runtime-env' +``` + +Make sure the command creates a `runtime-env` directory under the default working directory of `runtime_env`, and that `${workdir}/runtime-env/bin/` contains the expected executables, e.g.: + +- `${workdir}/runtime-env/bin/python` + +The same applies to Node.js: you can override the install command via `ROCK_RTENV_NODE_V22180_INSTALL_CMD` to use a faster download/install method. \ No newline at end of file From bf2dd18c2f34b5fca9f4b749f5abc15422bad837 Mon Sep 17 00:00:00 2001 From: "pengshixin.psx" Date: Thu, 29 Jan 2026 06:18:36 +0000 Subject: [PATCH 2/2] docs: update Python SDK runtime env docs --- .../References/Python SDK References/runtime-env.md | 2 +- .../References/Python SDK References/runtime-env.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/i18n/zh-Hans/docusaurus-plugin-content-docs/version-1.1.x/References/Python SDK References/runtime-env.md b/docs/i18n/zh-Hans/docusaurus-plugin-content-docs/version-1.1.x/References/Python SDK References/runtime-env.md index ca06e73d1..344a31205 100644 --- a/docs/i18n/zh-Hans/docusaurus-plugin-content-docs/version-1.1.x/References/Python SDK References/runtime-env.md +++ b/docs/i18n/zh-Hans/docusaurus-plugin-content-docs/version-1.1.x/References/Python SDK References/runtime-env.md @@ -107,7 +107,7 @@ class NodeRuntimeEnv(RuntimeEnv): ## 加速基础环境安装 -`PythonRuntimeEnv` 默认从 下载 Python 安装包。若网络不可达或下载较慢,可通过环境变量 `ROCK_RTENV_PYTHON_V31114_INSTALL_CMD` 或 `ROCK_RTENV_PYTHON_V31212_INSTALL_CMD` 覆盖默认安装命令(例如切换到内网源/镜像源)。 +`PythonRuntimeEnv` 默认从 https://github.com/astral-sh/python-build-standalone/releases/ 下载 Python 安装包。若网络不可达或下载较慢,可通过环境变量 `ROCK_RTENV_PYTHON_V31114_INSTALL_CMD` 或 `ROCK_RTENV_PYTHON_V31212_INSTALL_CMD` 覆盖默认安装命令(例如切换到内网源/镜像源)。 默认值示例: diff --git a/docs/versioned_docs/version-1.1.x/References/Python SDK References/runtime-env.md b/docs/versioned_docs/version-1.1.x/References/Python SDK References/runtime-env.md index d1940307d..9ec6244f3 100644 --- a/docs/versioned_docs/version-1.1.x/References/Python SDK References/runtime-env.md +++ b/docs/versioned_docs/version-1.1.x/References/Python SDK References/runtime-env.md @@ -106,7 +106,7 @@ class NodeRuntimeEnv(RuntimeEnv): ## Speeding Up Base Runtime Installation -`PythonRuntimeEnv` downloads Python packages from by default. If the network is unavailable or slow, you can override the default install command via `ROCK_RTENV_PYTHON_V31114_INSTALL_CMD` or `ROCK_RTENV_PYTHON_V31212_INSTALL_CMD` (e.g., switch to an internal registry or a mirror). +`PythonRuntimeEnv` downloads Python packages from https://github.com/astral-sh/python-build-standalone/releases/ by default. If the network is unavailable or slow, you can override the default install command via `ROCK_RTENV_PYTHON_V31114_INSTALL_CMD` or `ROCK_RTENV_PYTHON_V31212_INSTALL_CMD` (e.g., switch to an internal registry or a mirror). Default value example: