Introduction¶
In DSH, agents may need to prepare Python virtual environments for the current project, install dependencies, and then call the corresponding interpreter to run code. dsh-python-env provides a set of model tools for these operations.
It converges the discovery, creation, installation, uninstallation, and removal of Python virtual environments into a DSH plugin, and invokes the standard library python -m venv and pip in the host process via the DSH platform’s subprocess channel.
What is this¶
dsh-python-env is a DeepSeek Harness (DSH) plugin maintained by AngelosZou with an MIT license. It targets a single DSH workspace, providing workspace-wide Python virtual environment management.
It includes:
- Five model tools:
pyenv_discover,pyenv_create,pyenv_install,pyenv_uninstall,pyenv_remove python-envskill- system-prompt guidance section
Core Features¶
Covering Common Virtual Environment Operations¶
pyenv_discover is used to discover Python virtual environments within the current workspace.
pyenv_create is used to create a virtual environment.
pyenv_install is used to install dependencies into the environment, supporting packages and requirements.
pyenv_uninstall is used to remove dependencies from the environment.
pyenv_remove is used to remove virtual environments within the workspace.
Using Standard Library and DSH Subprocess Channel¶
The plugin does not depend on third-party environment managers like uv or virtualenv. It runs the standard library python -m venv and pip in the host process via the DSH platform’s subprocess channel.
Cross-Platform and Mirror Fallback¶
The plugin supports cross-platform layouts and interpreter chains for Windows, macOS, and Linux.
It supports PyPI mirrors and local proxy fallbacks, including TUNA, Aliyun, and USTC, and covers common local proxy ports.
Workspace Boundaries and Execution Strategy¶
The plugin restricts operations within the session workspace, with cache and temporary state located at:
<workspace>/.dsh-pyenv/
It does not touch the global Python environment, host pip cache, or system temporary directories.
Change-oriented tools respect the session sandbox policy and are rejected for execution in read-only sessions; pyenv_discover remains available.
All pyenv tools are subject to a two-minute time budget, with pyenv_discover limited to one minute.
Installation and Activation¶
Requirements:
- Node.js >= 20
- A DSH profile composed of
@deepseek-ai/dsh-base, providingsubprocess,jobs,tools, andskillsservices - The plugin-managed environment requires Python >= 3.8, available in PATH or passed explicitly
Installation Command:
dsh plugin --profile web add dsh-python-env
After installation, the DSH backend needs to be restarted. The tools will appear in new sessions, including pyenv_discover, pyenv_create, pyenv_install, pyenv_uninstall, pyenv_remove, and the python-env skill.
Typical Usage¶
pyenv_create
pyenv_install { packages: ["pytest>=8"] }
pyenv_install { requirements: "requirements.txt" }
pyenv_uninstall { packages: ["pytest"] }
pyenv_discover
After creating or discovering an environment, use the interpreter reported by the tool to run code:
Windows: <venv>\Scripts\python.exe
macOS/Linux: <venv>/bin/python
Use Cases and Notes¶
Suitable for managing Python project dependencies within DSH sessions where environment operations are desired to be limited to the current workspace.
Notes:
- The plugin runs with the permissions of the current DSH process, and
python -m venvandpipcalls are executed according to the environment available to that process; it is recommended to check the source code and MIT license before installation. - Change-oriented tools are rejected for execution in read-only sessions;
pyenv_discoverremains available. - All
pyenvtools are subject to a two-minute time budget, withpyenv_discoverlimited to one minute. - The plugin-managed environment requires Python >= 3.8.
Resources¶
GitHub Repository: