微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🐍

云端 Python 沙盒·百库预装即开即用

Python Executor · v0.1.5
专业技能 安全 A 级 作者 okaris 公开目录收录
7k 下载 3 安装 14.4k 收藏 72 浏览

简介

云端 Python 沙盒执行环境,预装100+库,支持数据处理、爬虫、图像视频处理及3D建模,无需本地配置一键运行

原始描述

Execute Python code in a safe sandboxed environment via [inference.sh](https://inference.sh). Pre-installed: NumPy, Pandas, Matplotlib, requests, BeautifulSo...

通过你的 Agent 添加

安装目录:python-executor/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/python-executor/
Codex CLI~/.codex/skills/python-executor/
DeepSeek Harness~/.agents/skills/python-executor/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心功能与用法

python-executor 是一款通过 CLI 调用 inference.sh 云服务的文档型 Skill,允许用户在隔离沙箱中执行 Python 代码。核心工作流为:本地通过 infsh CLI 提交代码 → 云端 Python 3.10 环境执行 → 返回 stdout 及 outputs/ 目录产物。支持一键式运行,无需本地配置 Python 环境或管理依赖。

预装生态覆盖数据科学(NumPy/Pandas/SciPy/Matplotlib)、网络爬虫(requests/BeautifulSoup/Selenium/Playwright/Scrapy)、图像处理(Pillow/OpenCV/scikit-image)、视频编辑(MoviePy/PyAV/ffmpeg-python)、3D 网格(trimesh/open3d/numpy-stl)及文档生成(ReportLab/PyPDF2/SVG)等 100+ 库。资源规格默认为 8GB RAM/30 秒超时,可通过 @high_memory 变体升级至 16GB,超时最高 300 秒。

显著优点

  1. 零环境摩擦:无需本地安装 Python 或冲突依赖,即开即用。
  2. 安全隔离:代码在云端沙箱子进程中运行,不接触本地文件系统,适合运行不可信或实验性脚本。
  3. 丰富预装库:覆盖数据分析、爬虫、多媒体处理、3D 等场景,减少 pip install 等待。
  4. 文件自动回传:标准输出及 outputs/ 目录文件自动打包返回,方便获取图表、视频、模型等产物。
  5. GPU 无关任务友好:纯 CPU 环境,适合非深度学习类批处理任务。

局限性与缺点

  1. 第三方平台依赖:所有计算在 inference.sh(T3 级别社区平台)完成,存在单点故障、隐私合规及长期可用性风险。
  2. 无 GPU 支持:无法运行 PyTorch/TensorFlow 等深度学习训练或 CUDA 加速任务。
  3. 网络与状态限制:无持久化存储,跨执行无状态;受限于平台网络策略,内网资源无法访问。
  4. 敏感数据风险:代码及数据需上传至第三方服务器,不适合处理机密信息或隐私数据。
  5. curl|bash 安装:官方推荐安装方式存在潜在供应链风险,虽文档提供 SHA-256 校验说明,但仍需用户主动验证。

适合人群

  • 需要快速验证 Python 脚本、进行数据清洗或可视化的分析师与开发者。
  • 不想维护本地爬虫环境,需临时抓取网页数据的用户。
  • 希望批量生成图像、短视频或简单 3D 模型的内容创作者。
  • 在隔离环境中测试不可信代码的安全研究者。

常规风险

  • 数据隐私:代码与数据上传至 inference.sh,需审阅其隐私政策。
  • 平台信任:T3 来源,建议关注官方安全公告及更新。
  • 凭证泄露:避免在提交代码中硬编码 API 密钥、数据库密码等敏感信息。
  • 资源超限:默认 30 秒/8GB 限制,长视频渲染或大数据集需主动调整超时及内存变体。

技能正文


name: python-executor description: "Execute Python code in a safe sandboxed environment via inference.sh. Pre-installed: NumPy, Pandas, Matplotlib, requests, BeautifulSoup, Selenium, Playwright, MoviePy, Pillow, OpenCV, trimesh, and 100+ more libraries. Use for: data processing, web scraping, image manipulation, video creation, 3D model processing, PDF generation, API calls, automation scripts. Triggers: python, execute code, run script, web scraping, data analysis, image processing, video editing, 3D models, automation, pandas, matplotlib" allowed-tools: Bash(belt *)

Install the belt CLI skill: npx skills add belt-sh/cli

Python Code Executor

Execute Python code in a safe, sandboxed environment with 100+ pre-installed libraries.

Python Code Executor

Quick Start

Requires inference.sh CLI (belt). Install instructions

belt login

# Run Python code
belt app run infsh/python-executor --input '{
  "code": "import pandas as pd\nprint(pd.__version__)"
}'

App Details

Property Value
App ID infsh/python-executor
Environment Python 3.10, CPU-only
RAM 8GB (default) / 16GB (high_memory)
Timeout 1-300 seconds (default: 30)

Input Schema

{
  "code": "print('Hello World!')",
  "timeout": 30,
  "capture_output": true,
  "working_dir": null
}

Pre-installed Libraries

Web Scraping & HTTP

  • requests, httpx, aiohttp - HTTP clients
  • beautifulsoup4, lxml - HTML/XML parsing
  • selenium, playwright - Browser automation
  • scrapy - Web scraping framework

Data Processing

  • numpy, pandas, scipy - Numerical computing
  • matplotlib, seaborn, plotly - Visualization

Image Processing

  • pillow, opencv-python-headless - Image manipulation
  • scikit-image, imageio - Image algorithms

Video & Audio

  • moviepy - Video editing
  • av (PyAV), ffmpeg-python - Video processing
  • pydub - Audio manipulation

3D Processing

  • trimesh, open3d - 3D mesh processing
  • numpy-stl, meshio, pyvista - 3D file formats

Documents & Graphics

  • svgwrite, cairosvg - SVG creation
  • reportlab, pypdf2 - PDF generation

Examples

Web Scraping

belt app run infsh/python-executor --input '{
  "code": "import requests\nfrom bs4 import BeautifulSoup\n\nresponse = requests.get(\"https://example.com\")\nsoup = BeautifulSoup(response.content, \"html.parser\")\nprint(soup.find(\"title\").text)"
}'

Data Analysis with Visualization

belt app run infsh/python-executor --input '{
  "code": "import pandas as pd\nimport matplotlib.pyplot as plt\n\ndata = {\"name\": [\"Alice\", \"Bob\"], \"sales\": [100, 150]}\ndf = pd.DataFrame(data)\n\nplt.bar(df[\"name\"], df[\"sales\"])\nplt.savefig(\"outputs/chart.png\")\nprint(\"Chart saved!\")"
}'

Image Processing

belt app run infsh/python-executor --input '{
  "code": "from PIL import Image\nimport numpy as np\n\n# Create gradient image\narr = np.linspace(0, 255, 256*256, dtype=np.uint8).reshape(256, 256)\nimg = Image.fromarray(arr, mode=\"L\")\nimg.save(\"outputs/gradient.png\")\nprint(\"Image created!\")"
}'

Video Creation

belt app run infsh/python-executor --input '{
  "code": "from moviepy.editor import ColorClip, TextClip, CompositeVideoClip\n\nclip = ColorClip(size=(640, 480), color=(0, 100, 200), duration=3)\ntxt = TextClip(\"Hello!\", fontsize=70, color=\"white\").set_position(\"center\").set_duration(3)\nvideo = CompositeVideoClip([clip, txt])\nvideo.write_videofile(\"outputs/hello.mp4\", fps=24)\nprint(\"Video created!\")",
  "timeout": 120
}'

3D Model Processing

belt app run infsh/python-executor --input '{
  "code": "import trimesh\n\nsphere = trimesh.creation.icosphere(subdivisions=3, radius=1.0)\nsphere.export(\"outputs/sphere.stl\")\nprint(f\"Created sphere with {len(sphere.vertices)} vertices\")"
}'

API Calls

belt app run infsh/python-executor --input '{
  "code": "import requests\nimport json\n\nresponse = requests.get(\"https://api.github.com/users/octocat\")\ndata = response.json()\nprint(json.dumps(data, indent=2))"
}'

File Output

Files saved to outputs/ are automatically returned:

# These files will be in the response
plt.savefig('outputs/chart.png')
df.to_csv('outputs/data.csv')
video.write_videofile('outputs/video.mp4')
mesh.export('outputs/model.stl')

Variants

# Default (8GB RAM)
belt app run infsh/python-executor --input input.json

# High memory (16GB RAM) for large datasets
belt app run infsh/python-executor@high_memory --input input.json

Use Cases

  • Web scraping - Extract data from websites
  • Data analysis - Process and visualize datasets
  • Image manipulation - Resize, crop, composite images
  • Video creation - Generate videos with text overlays
  • 3D processing - Load, transform, export 3D models
  • API integration - Call external APIs
  • PDF generation - Create reports and documents
  • Automation - Run any Python script

Important Notes

  • CPU-only - No GPU/ML libraries (use dedicated AI apps for that)
  • Safe execution - Runs in isolated subprocess
  • Non-interactive - Use plt.savefig() not plt.show()
  • File detection - Output files are auto-detected and returned

Related Skills

# AI image generation (for ML-based images)
npx skills add inference-sh/skills@ai-image-generation

# AI video generation (for ML-based videos)
npx skills add inference-sh/skills@ai-video-generation

# LLM models (for text generation)
npx skills add inference-sh/skills@llm-models

Documentation

正文来自原始仓库, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

原始仓库

作者的项目地址:https://github.com/101-skills/skills

标签

pythoncode-executionsandboxdata-processingweb-scrapingautomationpandasmatplotlibseleniumplaywrightinference-sh

同类 Skill