Token导航 LogoToken导航TokenDH.com
开发操作浏览器github未标认证来源可访问许可证需确认审计异常

setup-python-tools设置 Python tools

Agent Skill

用于辅助 Python 项目开发、测试、依赖管理和常见框架工作流。它适合让 Agent 阅读 Python 代码、定位测试问题、整理运行命令、生成脚本或分析数据处理逻辑。使用时需要确认项目虚拟环境、依赖版本和测试入口;涉及执行脚本、读写文件、访问数据库或调用外部 API 时,应先明确运行目录和输入输出范围,避免误改生产数据。

总安装

4,772

周安装

205

GitHub Stars

4

下载量

1,673
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:setup-python-tools(设置 Python tools)
来源仓库:https://github.com/cognitedata/dune-skills
仓库路径:skills/setup-python-tools
安装命令:
npx skills add https://github.com/cognitedata/dune-skills --skill setup-python-tools
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/cognitedata/dune-skills --skill setup-python-tools

简介

提供 Python 项目开发、测试和依赖管理的全流程支持。

  • 适用于 Codex、Claude、Cursor、Gemini CLI 中需要处理 Python 代码库的场景。
  • 通过 npx skills add 命令从 dune-skills 仓库安装。
  • 涉及虚拟环境和包安装,建议使用 pyenv 或 poetry 管理版本。
  • 注意 pip 源配置和私有包认证,避免下载中断或权限失败。

SKILL.md

Set Up Python Tool Execution

Add client-side Python tool execution via Pyodide to this Dune app.

Target: $ARGUMENTS

Background

Atlas agents can have Python tools defined in their CDF config (type: "runPythonCode"). When the agent calls one, it arrives as a toolConfirmation (auto-allowed) followed by a clientTool action. The library fetches the tool's Python code from the agent config automatically and executes it via the provided pythonRuntime.

You only need to:

  1. Set up usePyodideRuntime to get a runtime instance
  2. Pass pythonRuntime to useAtlasChat

No PythonToolConfig entries — the library reads the code from the agent's CDF config.

The flow is:

  1. usePyodideRuntime loads Pyodide (~30MB, cached after first load), installs packages, and injects Cognite SDK credentials into the Python environment
  2. When the agent calls a Python tool, the library fetches its code from the agent's CDF config (cached per session), wraps it, executes it in Pyodide, and returns the result

Step 1 — Understand the app

Read these files before touching anything:

  • package.json — detect package manager and existing deps
  • The component that calls useAtlasChat — understand current tools/config

Step 2 — Install Pyodide

Install exactly pyodide@0.29.3 using the app's package manager. This version must match the CDN artifacts loaded at runtime — installing a different version will cause errors.

  • pnpm → pnpm add pyodide@0.29.3
  • npm → npm install pyodide@0.29.3
  • yarn → yarn add pyodide@0.29.3
Note: @cognite/dune-industrial-components, @sinclair/typebox, ajv, ajv-formats should already be installed. If not, install them too (see the integrate-atlas-chat skill).

Step 3 — Set up usePyodideRuntime

In the component that calls useAtlasChat, add the Pyodide runtime hook:

import { loadPyodide } from "pyodide";
import { usePyodideRuntime } from "@cognite/dune-industrial-components/atlas-agent/pyodide";
import { useAtlasChat } from "@cognite/dune-industrial-components/atlas-agent/react";

function MyChat() {
  const { sdk, isLoading } = useDune();

  // Initialize Python runtime (loads Pyodide, installs packages, sets up Cognite SDK)
  const {
    runtime: pythonRuntime,
    loading: pythonLoading,
    progress: pythonProgress,
    error: pythonError,
    isReady: pythonReady,
  } = usePyodideRuntime({
    loadPyodide,
    client: isLoading ? null : sdk,
    requirements: ["pandas", "numpy"],    // optional — additional packages
  });

  // ... useAtlasChat below
}

Hook API reference

Return fieldTypeDescription
runtime`PythonRuntime \undefined`The initialized runtime, or undefined if not ready
loadingbooleanTrue while Pyodide is loading / initializing
error`string \null`Error message if initialization failed
progress{stage: string; percent: number}Current init progress for UI display
isReadybooleanConvenience: !loading &&!error && runtime!== undefined

Loading state UI

Place the loading indicator above the chat input, not in the message list. Keep it compact — a pill/badge showing stage text and percent. Show an error badge separately. First load is ~30-60s (downloads ~30MB); subsequent loads are <2s from browser cache.

{/* Loading — shown above the input while Pyodide initializes */}
{pythonLoading && (
  <div className="flex items-center gap-2 rounded-lg border bg-muted/50 px-3 py-2 text-sm text-muted-foreground">
    {/* Optional: <IconBrandPython /> from @tabler/icons-react */}
    <span>{pythonProgress.stage || "Initializing Python..."}</span>
    {pythonProgress.percent > 0 && pythonProgress.percent < 100 && (
      <span className="text-xs opacity-70">({pythonProgress.percent}%)</span>
    )}
  </div>
)}

{/* Error — shown if init fails (after loading finishes) */}
{pythonError && !pythonLoading && (
  <div className="flex items-center gap-2 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive">
    <span>Python runtime failed to load</span>
  </div>
)}

Step 4 — Wire into useAtlasChat

Pass the runtime to useAtlasChat. That's all — no tool configs needed:

const { messages, send, isStreaming, progress, error, reset, abort } = useAtlasChat({
  client: isLoading ? null : sdk,
  agentExternalId: "my-agent",
  tools: [renderTimeSeries],   // regular client tools (declared to agent), if any
  pythonRuntime,               // from usePyodideRuntime — enables Python tool execution
});

Note: Python tools are NOT declared to the agent via tools. The agent already knows about them from its CDF config. The library fetches the code automatically when needed.


Step 5 — Disable input while Python loads

The user shouldn't send messages before the runtime is ready. Disable the entire input area (not just the send button) so the state is unambiguous:

<ChatInput
  onSend={handleSend}
  disabled={isStreaming || pythonLoading}
  // ...
/>

If you have a home page with suggestion chips, disable those too:

<ChatHomePage
  onSuggestionClick={handleSuggestionClick}
  disabled={pythonLoading}
/>

Done

The app can now execute Python tools client-side via Pyodide. When the agent calls a Python tool, the library automatically fetches its code from the agent config, runs it in the browser, and returns the result to the agent.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.63%
按下载量换算613

Claude

30.22%
按下载量换算506

Cursor

19.68%
按下载量换算329

Gemini CLI

11.27%
按下载量换算189

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills