Xpersona
S

skill-python-env

CLAWHUB · Unverified

【OpenClaw 内部工具 skill】为其他 skill 提供 Python 虚拟环境管理。按 Python 版本号在 ~/.python_env/<version> 下创建共享环境,多个 skill 可复用同一版本环境。自动安装 uv(若未安装)。不直接面向用户。 Skill: skill-python-env Owner: liberalchang Summary: 【OpenClaw 内部工具 skill】为其他 skill 提供 Python 虚拟环境管理。按 Python 版本号在 ~/.python_env/<version> 下创建共享环境,多个 skill 可复用同一版本环境。自动安装 uv(若未安装)。不直接面向用户。 Tags: latest:1.0.0 Version history: v1.0.0 | 2026-03-31T04:58:35.329Z | user Initial release of skill-python-env – internal Python virtual environment manager for other skills: - Provides shared Python virtual environments by versi

62
Rank
84
Safety
967
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 967 downloads reported by the source. Last updated 10/12/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: medium.

clawhub skill install s1711a251cb269zj1bjvwcffxh83kcjh:skill-python-env
  1. Setup complexity is MEDIUM. Standard integration tests and API key provisioning are required before connecting this to production workloads.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-liberalchang-skill-python-env/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

7,101 characters of source documentation, loaded on request.

Extracted files

3 files captured from the source.

SKILL.md

---
name: skill-python-env
description: 【OpenClaw 内部工具 skill】为其他 skill 提供 Python 虚拟环境管理。按 Python 版本号在 ~/.python_env/<version> 下创建共享环境,多个 skill 可复用同一版本环境。自动安装 uv(若未安装)。不直接面向用户。
emoji: 🐍
metadata:
  clawdbot:
    config:
      requiredEnv: []
      stateDirs: []
      internal: true
      calledBy: other_skills
      example: |
        # 在其他 skill 脚本中调用(确保 Python 3.11 环境存在)
        bash ~/.openclaw/skills/skill-python-env/scripts/ensure_python_env.sh 3.11
        source ~/.python_env/3.11/bin/activate
---

# skill-python-env

> **内部工具 skill** — 本 skill 不直接响应用户指令,由其他需要 Python 环境的 skill 在执行时调用。

## 设计原则

- **按版本共享**:环境以 Python 版本号命名(`~/.python_env/3.11`),不同 skill 只要版本相同即复用同一环境,避免重复创建
- **幂等安全**:环境已存在则秒返回,包安装使用 `uv pip install`(已安装的包自动跳过)
- **零前置依赖**:uv 未安装时自动下载安装,安装完毕后继续执行,无需用户手动干预

## 目录结构

```
skill-python-env/
├── SKILL.md
├── _meta.json
└── scripts/
    ├── ensure_python_env.sh    # Shell 版(供 bash/zsh/Git Bash 调用)
    └── ensure_python_env.py    # Python 版(供 uv run 或 python3 调用)
```

## 调用接口

两个脚本功能完全相同,根据调用方语言选择。

### Shell 版

```bash
bash ~/.openclaw/skills/skill-python-env/scripts/ensure_python_env.sh <python_version> [packages...]
```

| 参数 | 说明 |
|------|------|
| `python_version` | 必填,如 `3.11`、`3.12` |
| `packages...` | 可选,追加安装的包,空格分隔 |

### Python 版(uv run)

```bash
uv run ~/.openclaw/skills/skill-python-env/scripts/ensure_python_env.py <python_version> [--packages pkg1 pkg2 ...]
```

| 参数 | 说明 |
|------|------|
| `python_version` | 必填,如 `3.11`、`3.12` |
| `--packages` | 可选,追加安装的包 |

## 输出格式

脚本运行完成后,stdout 末尾输出以下机器可读行,供调用方 grep 解析:

```
PYTHON_ENV_ACTIVATE:/home/user/.python_env/3.11/bin/activate
PYTHON_ENV_DIR:/home/user/.python_env/3.11
PYTHON_ENV_VERSION:3.11
```

## 其他 skill 集成示例

### 方式 A:直接激活后运行(Shell)

```bash
#!/usr/bin/env bash
# 其他 skill 的入口脚本

SKILL_ENV="$HOME/.openclaw/skills/skill-python-env/scripts/ensure_python_env.sh"

# 确保 Python 3.11 环境就绪,并安装本 skill 所需的包
bash "$SKILL_ENV" 3.11 requests httpx

# 激活并执行
source "$HOME/.python_env/3.11/bin/activate"
python -m my_skill "$@"
```

### 方式 B:解析输出路径(更健壮)

```bash
#!/usr/bin/env bash
SKILL_ENV="$HOME/.openclaw/skills/skill-python-env/scripts/ensure_python_env.sh"

OUTPUT=$(bash "$SKILL_ENV" 3.11 requests 2>&1)
echo "$OUTPUT"

ACTIVATE=$(echo "$OUTPUT" | grep '^PYTHON_ENV_ACTIVATE:' | cut -d: -f2-)
source "$ACTIVATE"
python -m my_skill "$@"
```

### 方式 C:Python 调用

```python
import subprocess, os
from pathlib import Path

script = Path.home() / ".openclaw/skills/skill-python-env/scripts/ensure_python_env.py"
result = subprocess.run(
    ["uv", "run", str(script), "3.11", "--packages", "requests"],
    capture_output=True, text=True
)
# 解析激活路径(仅用于参考,Python 脚本通常直接 import)
activate = next(
    line.split(":", 1)[1] for line in result.stdout.splitlines()
    if line.startswith("PYTHON_ENV_ACTIVATE:")
)
```

## 环境路径规范

| 平台 | 激活命令 |
|------|----------|
| Linux / macOS | `source ~/.python_env/3.11/bin/activate` |
| Windows (Git Bash) | `source ~/.python_env/3.11/Scripts/activate` |
| Windo

_meta.json

{
  "ownerId": "kn75j29qyaahtzr82k3xvmgtkx80mk2w",
  "slug": "skill-python-env",
  "version": "1.0.0",
  "publishedAt": 1774933115329
}

skill-card.md

## Description:

skill-python-env provides an internal Python virtual environment helper for other skills, creating shared versioned environments under ~/.python_env/<version> and installing uv automatically when missing.

This skill is ready for commercial/non-commercial use.

## Publisher:

[liberalchang](https://clawhub.ai/user/liberalchang)

### License/Terms of Use:

MIT-0

## Use Case:

Developers and other skill authors use this internal utility to prepare reusable Python virtual environments by version and optionally install packages before running Python-based skill workflows.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: The skill can automatically install uv by executing live remote installer scripts.

Mitigation: Preinstall uv from a trusted source or review the installer path and network behavior before allowing the skill to run.

Risk: The virtual environment path is derived from the requested Python version and incomplete environments may be recursively deleted.

Mitigation: Accept only plain Python version values such as 3.11 or 3.12 and restrict deletion to verified directories under ~/.python_env.

Risk: Callers can request package installation into the shared environment.

Mitigation: Limit callers to trusted skills and restrict package names to approved dependencies.

## Reference(s):

- [ClawHub skill page](https://clawhub.ai/liberalchang/skills/skill-python-env)
- [uv installation documentation](https://docs.astral.sh/uv/getting-started/installation/)

## Skill Output:

**Output Type(s):** [text, shell commands, configuration, guidance]

**Output Format:** [Plain text logs with machine-readable environment lines and Markdown documentation examples]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [Outputs activation path, environment directory, and Python version for caller parsing.]

## Skill Version(s):

1.0.0 (source: server release metadata and artifact _meta.json)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

Sponsored

Ads related to skill-python-env and adjacent AI workflows.