Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ async def main() -> None:
# 1. Create a sandbox
sandbox = await Sandbox.create(
"opensandbox/code-interpreter:v1.0.2",
entrypoint=["/opt/opensandbox/code-interpreter.sh"],
entrypoint=["/opt/code-interpreter/code-interpreter.sh"],
Comment thread
Pangjiping marked this conversation as resolved.
env={"PYTHON_VERSION": "3.11"},
timeout=timedelta(minutes=10),
)
Expand Down
2 changes: 1 addition & 1 deletion docs/README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ async def main() -> None:
# 1. Create a sandbox
sandbox = await Sandbox.create(
"sandbox-registry.cn-zhangjiakou.cr.aliyuncs.com/opensandbox/code-interpreter:v1.0.2",
entrypoint=["/opt/opensandbox/code-interpreter.sh"],
entrypoint=["/opt/code-interpreter/code-interpreter.sh"],
env={"PYTHON_VERSION": "3.11"},
timeout=timedelta(minutes=10),
)
Expand Down
2 changes: 1 addition & 1 deletion examples/code-interpreter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async def main() -> None:
sandbox = await Sandbox.create(
image,
connection_config=config,
entrypoint=["/opt/opensandbox/code-interpreter.sh"]
entrypoint=["/opt/code-interpreter/code-interpreter.sh"]
)

async with sandbox:
Expand Down
2 changes: 1 addition & 1 deletion examples/code-interpreter/main_use_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def main() -> None:
image,
connection_config=config,
extensions={"poolRef":"pool-sample"},
entrypoint=["/opt/opensandbox/code-interpreter.sh"],
entrypoint=["/opt/code-interpreter/code-interpreter.sh"],
env={
"TEST_ENV": "test",
},
Expand Down
2 changes: 1 addition & 1 deletion examples/rl-training/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async def _run_command(sandbox: Sandbox, command: str) -> bool:
def _with_python_env(command: str) -> str:
return (
"bash -lc '"
"source /opt/opensandbox/code-interpreter-env.sh "
"source /opt/code-interpreter/code-interpreter-env.sh "
"python ${PYTHON_VERSION:-3.14} >/dev/null "
"&& "
f"{command}"
Expand Down
12 changes: 6 additions & 6 deletions sandboxes/code-interpreter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ RUN set -euo pipefail \
&& versions=("3.10" "3.11" "3.12" "3.13" "3.14") \
&& for version in "${versions[@]}"; do \
echo "Setting up ipykernel for Python $version" \
&& . /opt/opensandbox/code-interpreter-env.sh python $version \
&& . /opt/code-interpreter/code-interpreter-env.sh python $version \
Comment thread
Pangjiping marked this conversation as resolved.
&& python3 --version \
&& python3 -m pip install ipykernel jupyter bash_kernel --break-system-packages; \
done \
Expand All @@ -56,7 +56,7 @@ RUN set -euo pipefail \
&& versions=("18" "20" "22") \
&& for version in "${versions[@]}"; do \
echo "Setting up tslab for Node $version" \
&& . /opt/opensandbox/code-interpreter-env.sh node $version \
&& . /opt/code-interpreter/code-interpreter-env.sh node $version \
&& node --version \
&& npm --version \
&& npm install -g tslab; \
Expand All @@ -69,7 +69,7 @@ RUN set -euo pipefail \
&& versions=("1.25" "1.24" "1.23") \
&& for version in "${versions[@]}"; do \
echo "Setting up gonb for Go $version" \
&& . /opt/opensandbox/code-interpreter-env.sh go $version \
&& . /opt/code-interpreter/code-interpreter-env.sh go $version \
&& go version \
&& go install github.com/janpfeifer/gonb@latest \
&& go install golang.org/x/tools/cmd/goimports@latest \
Expand All @@ -85,9 +85,9 @@ ENV JUPYTER_HOST=http://127.0.0.1:44771 \
GO_VERSION=1.25 \
JAVA_VERSION=21

COPY scripts/code-interpreter.sh /opt/opensandbox/code-interpreter.sh
COPY scripts/code-interpreter.sh /opt/code-interpreter/code-interpreter.sh
Comment thread
Pangjiping marked this conversation as resolved.
COPY scripts/jupyter_notebook_config.py /root/.jupyter/
RUN chmod +x /opt/opensandbox/code-interpreter.sh
RUN chmod +x /opt/code-interpreter/code-interpreter.sh

WORKDIR /workspace
ENTRYPOINT ["/opt/opensandbox/code-interpreter.sh"]
ENTRYPOINT ["/opt/code-interpreter/code-interpreter.sh"]
6 changes: 3 additions & 3 deletions sandboxes/code-interpreter/Dockerfile_base
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ RUN mkdir -p ${GO_ROOT} && \
ENV GOROOT=${GO_ROOT}/${GO_V1_25} \
PATH="${NODE_ROOT}/v${NODE_V22}/bin:${GO_ROOT}/${GO_V1_25}/bin:${PATH}"

RUN mkdir -p /opt/opensandbox
COPY scripts/code-interpreter-env.sh /opt/opensandbox/code-interpreter-env.sh
RUN chmod +x /opt/opensandbox/code-interpreter-env.sh
RUN mkdir -p /opt/code-interpreter
COPY scripts/code-interpreter-env.sh /opt/code-interpreter/code-interpreter-env.sh
Comment thread
Pangjiping marked this conversation as resolved.
RUN chmod +x /opt/code-interpreter/code-interpreter-env.sh

CMD ["/bin/bash"]
24 changes: 12 additions & 12 deletions sandboxes/code-interpreter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ If you set `EXECD_CLONE3_COMPAT` to `1`, `true`, `yes`, `on`, or `reexec` (same

## Version Switching

The image includes a built-in version switching script `/opt/opensandbox/code-interpreter-env.sh`. You need to use the
The image includes a built-in version switching script `/opt/code-interpreter/code-interpreter-env.sh`. You need to use the
`source` command to load it to modify the current shell's environment variables.

### Basic Usage

```bash
source /opt/opensandbox/code-interpreter-env.sh <language> <version>
source /opt/code-interpreter/code-interpreter-env.sh <language> <version>
```

### Examples
Expand All @@ -80,7 +80,7 @@ source /opt/opensandbox/code-interpreter-env.sh <language> <version>

```bash
# Switch to Python 3.11
source /opt/opensandbox/code-interpreter-env.sh python 3.11
source /opt/code-interpreter/code-interpreter-env.sh python 3.11
python3 --version
# Output: Python 3.11.x
```
Expand All @@ -89,23 +89,23 @@ python3 --version

```bash
# Switch to Java 8
source /opt/opensandbox/code-interpreter-env.sh java 8
source /opt/code-interpreter/code-interpreter-env.sh java 8
java -version
```

**Switch Node.js Version:**

```bash
# Switch to Node 22
source /opt/opensandbox/code-interpreter-env.sh node 22
source /opt/code-interpreter/code-interpreter-env.sh node 22
node -v
```

**Switch Go Version:**

```bash
# Switch to Go 1.25
source /opt/opensandbox/code-interpreter-env.sh go 1.25
source /opt/code-interpreter/code-interpreter-env.sh go 1.25
go version
```

Expand All @@ -115,16 +115,16 @@ If you don't specify a version number, the script will list all available versio

```bash
# List all Python versions
source /opt/opensandbox/code-interpreter-env.sh python
source /opt/code-interpreter/code-interpreter-env.sh python

# List all Java versions
source /opt/opensandbox/code-interpreter-env.sh java
source /opt/code-interpreter/code-interpreter-env.sh java

# List all Node.js versions
source /opt/opensandbox/code-interpreter-env.sh node
source /opt/code-interpreter/code-interpreter-env.sh node

# List all Go versions
source /opt/opensandbox/code-interpreter-env.sh go
source /opt/code-interpreter/code-interpreter-env.sh go
```

## Default Versions
Expand Down Expand Up @@ -154,7 +154,7 @@ The image comes with pre-configured Jupyter kernels for all supported languages:
### Starting Jupyter

```bash
/opt/opensandbox/code-interpreter.sh
/opt/code-interpreter/code-interpreter.sh
```

### Environment Variables
Expand Down Expand Up @@ -230,7 +230,7 @@ code-interpreter/
If a specific version is not found, list available versions:

```bash
source /opt/opensandbox/code-interpreter-env.sh <language>
source /opt/code-interpreter/code-interpreter-env.sh <language>
```

## License
Expand Down
22 changes: 11 additions & 11 deletions sandboxes/code-interpreter/README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ docker run -it --rm \

## 如何切换版本

镜像内置了一个环境切换脚本 `/opt/opensandbox/code-interpreter-env.sh`,你需要使用 `source` 命令加载它来修改当前 Shell
镜像内置了一个环境切换脚本 `/opt/code-interpreter/code-interpreter-env.sh`,你需要使用 `source` 命令加载它来修改当前 Shell
的环境变量。

### 基本用法

```bash
source /opt/opensandbox/code-interpreter-env.sh <language> <version>
source /opt/code-interpreter/code-interpreter-env.sh <language> <version>
```

### 示例
Expand All @@ -79,7 +79,7 @@ source /opt/opensandbox/code-interpreter-env.sh <language> <version>

```bash
# 切换到 Python 3.11
source /opt/opensandbox/code-interpreter-env.sh python 3.11
source /opt/code-interpreter/code-interpreter-env.sh python 3.11
python3 --version
# Output: Python 3.11.x
```
Expand All @@ -88,23 +88,23 @@ python3 --version

```bash
# 切换到 Java 8
source /opt/opensandbox/code-interpreter-env.sh java 8
source /opt/code-interpreter/code-interpreter-env.sh java 8
java -version
```

**切换 Node.js 版本:**

```bash
# 切换到 Node 22
source /opt/opensandbox/code-interpreter-env.sh node 22
source /opt/code-interpreter/code-interpreter-env.sh node 22
node -v
```

**切换 Go 版本:**

```bash
# 切换到 Go 1.25
source /opt/opensandbox/code-interpreter-env.sh go 1.25
source /opt/code-interpreter/code-interpreter-env.sh go 1.25
go version
```

Expand All @@ -114,16 +114,16 @@ go version

```bash
# 查看所有 Python 版本
source /opt/opensandbox/code-interpreter-env.sh python
source /opt/code-interpreter/code-interpreter-env.sh python

# 查看所有 Java 版本
source /opt/opensandbox/code-interpreter-env.sh java
source /opt/code-interpreter/code-interpreter-env.sh java

# 查看所有 Node.js 版本
source /opt/opensandbox/code-interpreter-env.sh node
source /opt/code-interpreter/code-interpreter-env.sh node

# 查看所有 Go 版本
source /opt/opensandbox/code-interpreter-env.sh go
source /opt/code-interpreter/code-interpreter-env.sh go
```

## 默认版本
Expand Down Expand Up @@ -152,7 +152,7 @@ source /opt/opensandbox/code-interpreter-env.sh go
### 启动 Jupyter

```bash
/opt/opensandbox/code-interpreter.sh
/opt/code-interpreter/code-interpreter.sh
```

### 环境变量
Expand Down
10 changes: 5 additions & 5 deletions sandboxes/code-interpreter/scripts/code-interpreter-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
# limitations under the License.

# This script is used to switch versions of different languages in the OpenSandbox environment
# Usage: source /opt/opensandbox/code-interpreter-env.sh <language> <version>
# Usage: source /opt/code-interpreter/code-interpreter-env.sh <language> <version>
# Examples:
# source /opt/opensandbox/code-interpreter-env.sh python 3.13
# source /opt/opensandbox/code-interpreter-env.sh java 21
# source /opt/opensandbox/code-interpreter-env.sh node 22
# source /opt/opensandbox/code-interpreter-env.sh go 1.25
# source /opt/code-interpreter/code-interpreter-env.sh python 3.13
# source /opt/code-interpreter/code-interpreter-env.sh java 21
# source /opt/code-interpreter/code-interpreter-env.sh node 22
# source /opt/code-interpreter/code-interpreter-env.sh go 1.25

function usage() {
echo "Usage: source code-interpreter-env.sh <language> <version>"
Expand Down
22 changes: 11 additions & 11 deletions sandboxes/code-interpreter/scripts/code-interpreter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,41 +62,41 @@ record_env_selection() {
tmp_file=$(mktemp)

if [ -f "$BASHRC_FILE" ]; then
grep -vE "^source /opt/opensandbox/code-interpreter-env.sh ${lang}(\\s|$)" "$BASHRC_FILE" >"$tmp_file" || true
grep -vE "^source /opt/code-interpreter/code-interpreter-env.sh ${lang}(\\s|$)" "$BASHRC_FILE" >"$tmp_file" || true
else
: >"$tmp_file"
fi

echo "source /opt/opensandbox/code-interpreter-env.sh ${lang} ${version}" >>"$tmp_file"
echo "source /opt/code-interpreter/code-interpreter-env.sh ${lang} ${version}" >>"$tmp_file"
mv "$tmp_file" "$BASHRC_FILE"
}

if [ -n "${PYTHON_VERSION:-}" ]; then
source /opt/opensandbox/code-interpreter-env.sh python "${PYTHON_VERSION}"
source /opt/code-interpreter/code-interpreter-env.sh python "${PYTHON_VERSION}"
record_env_selection python "${PYTHON_VERSION}"
else
source /opt/opensandbox/code-interpreter-env.sh python
source /opt/code-interpreter/code-interpreter-env.sh python
fi

if [ -n "${JAVA_VERSION:-}" ]; then
source /opt/opensandbox/code-interpreter-env.sh java "${JAVA_VERSION}"
source /opt/code-interpreter/code-interpreter-env.sh java "${JAVA_VERSION}"
record_env_selection java "${JAVA_VERSION}"
else
source /opt/opensandbox/code-interpreter-env.sh java
source /opt/code-interpreter/code-interpreter-env.sh java
fi

if [ -n "${NODE_VERSION:-}" ]; then
source /opt/opensandbox/code-interpreter-env.sh node "${NODE_VERSION}"
source /opt/code-interpreter/code-interpreter-env.sh node "${NODE_VERSION}"
record_env_selection node "${NODE_VERSION}"
else
source /opt/opensandbox/code-interpreter-env.sh node
source /opt/code-interpreter/code-interpreter-env.sh node
fi

if [ -n "${GO_VERSION:-}" ]; then
source /opt/opensandbox/code-interpreter-env.sh go "${GO_VERSION}"
source /opt/code-interpreter/code-interpreter-env.sh go "${GO_VERSION}"
record_env_selection go "${GO_VERSION}"
else
source /opt/opensandbox/code-interpreter-env.sh go
source /opt/code-interpreter/code-interpreter-env.sh go
fi

setup_python() {
Expand Down Expand Up @@ -167,4 +167,4 @@ pids+=($!)
setup_bash &
pids+=($!)

jupyter notebook --ip=127.0.0.1 --port="${JUPYTER_PORT:-44771}" --allow-root --no-browser --NotebookApp.token="${JUPYTER_TOKEN:-opensandboxcodeinterpreterjupyter}" >/opt/opensandbox/jupyter.log
jupyter notebook --ip=127.0.0.1 --port="${JUPYTER_PORT:-44771}" --allow-root --no-browser --NotebookApp.token="${JUPYTER_TOKEN:-opensandboxcodeinterpreterjupyter}" >/opt/code-interpreter/jupyter.log
4 changes: 2 additions & 2 deletions sdks/code-interpreter/csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ try
{
ConnectionConfig = config,
Image = "opensandbox/code-interpreter:v1.0.2",
Entrypoint = new[] { "/opt/opensandbox/code-interpreter.sh" },
Entrypoint = new[] { "/opt/code-interpreter/code-interpreter.sh" },
Env = new Dictionary<string, string>
{
["PYTHON_VERSION"] = "3.11",
Expand Down Expand Up @@ -89,7 +89,7 @@ await using var sandbox = await Sandbox.CreateAsync(new SandboxCreateOptions
{
ConnectionConfig = new ConnectionConfig(),
Image = "opensandbox/code-interpreter:v1.0.2",
Entrypoint = new[] { "/opt/opensandbox/code-interpreter.sh" },
Entrypoint = new[] { "/opt/code-interpreter/code-interpreter.sh" },
Diagnostics = new SdkDiagnosticsOptions
{
LoggerFactory = loggerFactory
Expand Down
4 changes: 2 additions & 2 deletions sdks/code-interpreter/csharp/README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ await using var sandbox = await Sandbox.CreateAsync(new SandboxCreateOptions
{
ConnectionConfig = config,
Image = "opensandbox/code-interpreter:v1.0.2",
Entrypoint = new[] { "/opt/opensandbox/code-interpreter.sh" },
Entrypoint = new[] { "/opt/code-interpreter/code-interpreter.sh" },
Env = new Dictionary<string, string>
{
["PYTHON_VERSION"] = "3.11",
Expand Down Expand Up @@ -132,7 +132,7 @@ await using var sandbox = await Sandbox.CreateAsync(new SandboxCreateOptions
{
ConnectionConfig = config,
Image = "opensandbox/code-interpreter:v1.0.2",
Entrypoint = new[] { "/opt/opensandbox/code-interpreter.sh" },
Entrypoint = new[] { "/opt/code-interpreter/code-interpreter.sh" },
Env = new Dictionary<string, string>
{
["JAVA_VERSION"] = "17",
Expand Down
4 changes: 2 additions & 2 deletions sdks/code-interpreter/javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const config = new ConnectionConfig({
const sandbox = await Sandbox.create({
connectionConfig: config,
image: "opensandbox/code-interpreter:v1.0.2",
entrypoint: ["/opt/opensandbox/code-interpreter.sh"],
entrypoint: ["/opt/code-interpreter/code-interpreter.sh"],
env: {
PYTHON_VERSION: "3.11",
JAVA_VERSION: "17",
Expand Down Expand Up @@ -100,7 +100,7 @@ You can specify the desired version of a programming language by setting the cor
const sandbox = await Sandbox.create({
connectionConfig: config,
image: "opensandbox/code-interpreter:v1.0.2",
entrypoint: ["/opt/opensandbox/code-interpreter.sh"],
entrypoint: ["/opt/code-interpreter/code-interpreter.sh"],
env: {
JAVA_VERSION: "17",
GO_VERSION: "1.24",
Expand Down
Loading
Loading