← 返回 Skills 市场
ugpoor

Dolphindb Init

作者 superStupidBear · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
169
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install dolphindb-init
功能描述
DolphinDB Python 环境初始化技能。自动检测并切换到已安装 DolphinDB SDK 的 Python 环境(含 Anaconda/Miniconda/系统 Python),若未找到则自动安装。**这是 DolphinDB 套件的前置依赖,所有 DolphinDB 相关操作必须首先执行此技能**。
使用说明 (SKILL.md)

DolphinDB 初始化技能

🎯 套件角色

这是 DolphinDB Skill 套件的前置依赖技能。

所有 DolphinDB 相关技能在执行前都必须先调用此技能:

任何 DolphinDB 请求
    ↓
[必须] dolphindb-init ← 你在这里
    ↓
环境检测 ✓
    ↓
调用功能技能
    ├─ dolphindb-core(连接、读写)
    └─ dolphindb-query(查询、分析)

触发条件

任何时候 用户提到 DolphinDB 并需要操作:

  • "连接 DolphinDB"
  • "查询 DolphinDB 数据"
  • "在 DolphinDB 中建表"
  • "DolphinDB 性能分析"
  • 任何 DolphinDB Python SDK 相关操作

核心流程

1. 环境检测(必须第一步)

# 加载环境检测器
source ~/.openclaw/skills/dolphindb-init/scripts/load_dolphindb_env.sh

# 查看环境信息
dolphin_env_info

# 使用统一的 Python 调用函数
dolphin_python your_script.py

2. 检测逻辑

检测脚本按以下顺序扫描:

  1. conda 环境列表 → 检查每个环境的 pip list,查找 dolphindb
  2. Anaconda/Miniconda 路径 → 检查 $CONDA_BASE_1, $CONDA_BASE_2
  3. 系统 Python 环境 → 检查 $SYS_PYTHON_1, $SYS_PYTHON_2
  4. 决策
    • 找到已安装 → 导出环境变量 DOLPHINDB_PYTHON_BIN
    • 未找到 → 自动安装到 Python 3.13 环境

3. 环境变量

加载后可用的环境变量:

$DOLPHINDB_PYTHON_BIN    # Python 二进制路径(统一调用入口)
$DOLPHINDB_SDK_VERSION   # DolphinDB SDK 版本
$DOLPHINDB_PYTHON_VER    # Python 版本
$DOLPHINDB_ENV_PATH      # 环境路径

4. 统一调用方式

# 运行 Python 脚本
dolphin_python script.py

# 安装包
dolphin_pip install package_name

# 直接使用环境变量
$DOLPHINDB_PYTHON_BIN script.py

示例:DolphinDB 连接

import dolphindb as ddb

# 创建连接
s = ddb.session()
s.connect("localhost", 8848, "admin", "password")

# 执行查询
result = s.run("select * from trade where date=2024.01.01")
print(result)

# 关闭连接
s.close()

使用加载器运行:

source ~/.openclaw/skills/dolphindb-init/scripts/load_dolphindb_env.sh
dolphin_python connect_dolphindb.py

隐私保护

所有路径都用变量符号表示,不暴露具体系统地址:

变量名 含义
$CONDA_BASE_1 第一个 anaconda/miniconda 路径
$CONDA_BASE_2 第二个 anaconda/miniconda 路径
$SYS_PYTHON_1 第一个系统 Python 路径
$PY13_CANDIDATE_1 Python 3.13 候选路径

故障排除

问题 1: 找不到环境

# 手动运行检测脚本查看详细信息
bash ~/.openclaw/skills/dolphindb-init/scripts/detect_dolphindb_env.sh

问题 2: SDK 版本不兼容

dolphin_pip uninstall dolphindb
dolphin_pip install dolphindb==3.0.4.2

问题 3: Python 版本不是 3.13

# 检查当前环境
dolphin_env_info

# 强制安装到特定路径
~/anaconda3/bin/python -m pip install dolphindb

相关文件

  • scripts/detect_dolphindb_env.sh - 核心检测脚本,输出可 eval 的 export
  • scripts/load_dolphindb_env.sh - 环境加载器,提供统一调用函数
  • scripts/find_dolphindb_env.sh - 详细检测脚本(带完整输出)

套件关系

  • 本技能 - dolphindb-init(环境初始化,前置依赖)
  • 核心操作 - dolphindb-core(连接、表操作、数据读写)
  • 高级查询 - dolphindb-query(聚合、时间序列、数据分析)

注意事项

  1. 必须优先检测 - 不要假设 Python 环境已就绪
  2. 使用统一接口 - 始终通过 dolphin_python$DOLPHINDB_PYTHON_BIN 调用
  3. 版本兼容 - 优先使用 Python 3.13 环境
  4. 环境隔离 - 不同终端可能使用不同环境,必须每次检测
  5. 套件前置 - 所有 DolphinDB 技能依赖此技能,必须首先执行
安全使用建议
This skill appears to do what it says: detect a Python environment with dolphindb and provide wrapper functions. Before running it: (1) inspect the included scripts yourself (they are small and human-readable); (2) be aware that if no existing SDK is found the skill will run pip install dolphindb (network download, environment change) — consider running in a virtualenv or container if you want isolation; (3) note the loader uses eval of the detector's output to export variables — ensure the files come from a trusted source and have not been tampered with; (4) if you prefer explicit consent, modify scripts to prompt before installing or to print the install command instead of running it automatically.
功能分析
Type: OpenClaw Skill Name: dolphindb-init Version: 1.0.0 The skill bundle is designed to automate the initialization of a Python environment for the DolphinDB SDK. It scans for existing Conda or system Python environments containing the 'dolphindb' package and installs it via pip if not found (scripts/detect_dolphindb_env.sh). While it uses 'eval' to load environment variables in scripts/load_dolphindb_env.sh, this is a standard pattern for shell-based environment managers and is used here solely to set up the execution context for subsequent DolphinDB operations without any evidence of malicious intent, data exfiltration, or unauthorized access.
能力评估
Purpose & Capability
Name/description match the actual files and behavior: the scripts search Conda and system Python installations for a dolphindb package, export a unified Python binary variable, and provide wrapper functions. Nothing requested or coded is unrelated to environment initialization.
Instruction Scope
SKILL.md and scripts stay within environment detection/setup. Two items to be aware of: (1) detect_dolphindb_env.sh emits export statements that load_dolphindb_env.sh evals — eval is used only to set environment variables generated by the included script, but evaluating generated shell output is a point where a tampered script could inject commands; (2) when no existing SDK is found the scripts run pip install dolphindb at runtime (quietly), which modifies the user's Python environment and downloads packages from PyPI.
Install Mechanism
There is no separate install spec in the registry (instruction-only), but the runtime behavior includes invoking pip to fetch and install the dolphindb package from the network. This is an expected mechanism for installing the SDK, but it will perform network downloads and modify the environment when executed.
Credentials
The skill requests no credentials, no config paths, and the environment variables it sets (DOLPHINDB_PYTHON_BIN, DOLPHINDB_SDK_VERSION, etc.) are appropriate for the stated purpose. The number and type of env vars are proportionate.
Persistence & Privilege
The skill is not forced-always, does not modify other skills, and does not request elevated privileges. It modifies the local Python environment only when it runs pip install (standard for package setup).
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install dolphindb-init
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /dolphindb-init 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
dolphindb-init 1.0.0 - 首次发布 DolphinDB Python 环境初始化技能。 - 自动检测并切换到已安装 DolphinDB SDK 的 Python 环境(支持 Anaconda/Miniconda/系统 Python),若未找到则自动安装。 - 提供统一的调用接口(如 dolphin_python、dolphin_pip),导出标准环境变量。 - 明确作为 DolphinDB 技能套件的前置依赖,所有 DolphinDB 操作需首先执行本技能。 - 包含环境检测、变量管理、故障排查指引等详细说明。
元数据
Slug dolphindb-init
版本 1.0.0
许可证 MIT-0
累计安装 1
当前安装数 0
历史版本数 1
常见问题

Dolphindb Init 是什么?

DolphinDB Python 环境初始化技能。自动检测并切换到已安装 DolphinDB SDK 的 Python 环境(含 Anaconda/Miniconda/系统 Python),若未找到则自动安装。**这是 DolphinDB 套件的前置依赖,所有 DolphinDB 相关操作必须首先执行此技能**。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 169 次。

如何安装 Dolphindb Init?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install dolphindb-init」即可一键安装,无需额外配置。

Dolphindb Init 是免费的吗?

是的,Dolphindb Init 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Dolphindb Init 支持哪些平台?

Dolphindb Init 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Dolphindb Init?

由 superStupidBear(@ugpoor)开发并维护,当前版本 v1.0.0。

💬 留言讨论