emuco/dsh-venv

Plugin插件 Native原生 ⭐ 2 Dev Workflow开发与代码工作流

Per-project runtime environments for DeepSeek Harness: auto-adopt or create a project-local Python venv (.venv_local/python) and wire in toolchains/env vars for the runtimes each project uses.

Project Overview项目介绍

emuco/dsh-venv is a DSH-native plugin built exclusively for DeepSeek Harness that manages per-project isolated runtime environments. It can be installed in two ways, either from the public npm registry with the command dsh plugin --profile web add dsh-venv, or directly from the GitHub source code with dsh plugin --profile web add github:emuco/dsh-venv. After installation completes, you must restart DSH for the plugin to load correctly, as this is a requirement for DSH to load any new plugin layer. It automatically detects project runtimes from standard configuration files, then creates or takes over the corresponding environments and injects the correct environment variables.

This plugin addresses common pain points that arise when working with multiple Python projects in DSH. If all DSH workspaces share the system-wide Python installation, cross-project dependency pollution can occur, changes from one project can break the system Python installation, and environments cannot be easily moved when switching devices or workspaces. By giving every project its own isolated environment, dsh-venv eliminates these issues. It is designed for any developer working on Python, Node.js, or Go projects within DSH, and requires zero manual configuration after installation.

dsh-venv is released under the permissive MIT license, which allows free use and modification. It places all isolated environments in a .venv_local directory in your project root, with a separate subdirectory for each supported runtime. It follows a "take over if exists, create if not" rule, so it will never overwrite an existing environment, and will throw an error instead of silently falling back to the system Python if the project environment is missing or invalid. Developers can run the built-in node tests with the npm test command when modifying the source code.

这是一个面向 DeepSeek Harness(DSH)的原生项目环境管理插件,为每个 DSH 工作区或项目提供独立的运行时环境。它可自动识别项目使用的运行时,自动创建或接管 Python 虚拟环境,同时能在检测到对应配置文件时关联 Node.js 和 Go 运行时,注入相关环境变量,保证 python、pip 命令永远指向项目环境,不会静默回落到系统 Python。

当开发者在 DSH 中同时打开多个 Python 相关项目时,如果所有项目共享系统 Python 环境,容易出现不同项目依赖互相污染、系统 Python 被项目改动影响变得不可控,以及更换设备或工作区后环境无法迁移的问题。dsh-venv 通过为每个项目分配独立环境,解决了这些问题,适合所有需要在 DSH 中开发多语言项目的开发者使用。

该项目遵循 MIT 许可证,可通过 npm 或 GitHub 源码两种方式安装,安装命令分别为 dsh plugin --profile web add dsh-venv 和 dsh plugin --profile web add github:emuco/dsh-venv。安装完成后需要重启 DSH 才能生效,项目内置单元测试,可通过 npm test 命令运行测试。它支持 Python、Node.js、Go 三种运行时,遵循「有则接管,无则自动建」的设计原则,无需额外配置。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 2 warnings2 项注意
  • No license declared - all rights reserved by default; ask the author before commercial use or redistribution未声明开源许可证 —— 默认「保留所有权利」,商用或再分发前先问作者
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add dsh-venv

把 emuco/dsh-venv 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-venv

为每个 DSH 工作区 / 项目提供独立的运行时环境。自动识别项目用了哪些运行时,自动创建/接管 python venv,并把各运行时的环境变量注入到工作区——python/pip 永远走项目环境,绝不静默落到系统 Python。

DeepSeek Harness(DSH)项目环境管理插件。


为什么需要它

在 DSH 里打开多个项目时,如果所有会话共享系统 Python,容易出现:

  • 不同项目依赖互相污染(A 项目装了包,B 项目"看到了")
  • 系统 Python 被项目改动弄得不可控
  • 换机器 / 换工作区,环境没法跟着项目走

dsh-venv 给每个项目一个独立环境,让 agent 跑 Python 工具时永远用项目自己的解释器。

设计理念

  • 有则接管,无则自动建:目录存在就接管,不存在就 python -m venv .venv_local/python 自动创建——不需要任何配置步骤。
  • 一个文件夹承载多运行时:.venv_local/ 是环境容器,每种运行时一个子目录:
    项目根/
    └── .venv_local/
        ├── python/   ← Python(venv,自动创建/接管)
        ├── node/     ← Node(检测到 package.json 时链接)
        └── go/       ← Go(检测到 go.mod 时链接)
    
  • 自动识别,零配置:检测到 pyproject.toml/requirements.txt→python、package.json→node、go.mod→go,把对应运行时的工具链 bin 前置 PATH 并注入专属变量(VIRTUAL_ENV、NODE_PATH、GOBIN)。
  • 安全优先:缺少/无效的环境会报错,绝不静默回退到系统 Python;绝不覆盖已存在的环境。

功能

能力 说明
🎯 工具 project_env_status(查看/自动接管)、project_env_ensure(缺失即自动建 venv)、project_env_run(在项目环境中执行命令)
🖥️ Web 面板 设置页新增「项目环境」区,列出所有会话工作区的环境,状态一目了然
🧩 多运行时 python(venv 真环境)+ node / go(工具链接入、变量注入)
🔒 安全 无 venv 即报错,不回落系统 Python;不覆盖已有环境

安装

# 从 npm 安装:
dsh plugin --profile web add dsh-venv

# 或从 GitHub 源码安装:
dsh plugin --profile web add github:emuco/dsh-venv

安装后重启 DSH 生效(重启是 DSH 加载新 plugin 层的条件)。

使用

装好即可用,无需配置。agent 在上述系统提示的引导下会自动调用 project_env_* 工具;你也随时可以在设置页的「项目环境」面板查看各工作区的环境状态。

目录结构

  • src/index.js — 核心:路径、detect/status/environment、resolveCommand、create、run、多运行时 environmentAll
  • src/plugin.js — DSH host 插件:工具 + web API + 系统提示
  • src/client.js — DSH client 端:设置面板
  • cordis.patch.yml — DSH profile 插入补丁

开发

cd dsh-venv
npm test        # 运行测试(node --test)

License

MIT

← 上一个 Prev dsh-full-with-approval 下一个 Next dsh-context-mode →