fix(python): make Windows release paths native

Run the GitHub Windows runtime leg under the runner’s native PowerShell instead of inheriting the POSIX Bash body. POSIX and Windows now own explicit output resolution, virtual-environment setup, environment scrubbing, and keyless/live black-box commands, while portable build commands continue to use each runner’s default shell.

Put the pinned uv installation on the GitLab Windows job PATH before either the smoke or release builder invokes it. Reject a runtime executable whose basename does not match the selected platform manifest, and reject Intel macOS at platform selection instead of reporting a misleading missing artifact.

Add a complete PowerShell path to the published Python tutorial and record the three-phase shutdown-time bound in the Windows runtime decision. Workflow, Python, and bilingual documentation tests pin the resulting behavior.
This commit is contained in:
Tianyi Cui
2026-08-24 19:09:40 +08:00
parent d4a63abe85
commit 8101a0d097
13 changed files with 270 additions and 67 deletions
+2 -2
View File
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/user/guide/python-sdk.md
python-sdk.md: 5fd8b35c08acdd0f0ff457547ca62b31e12994d5
python-sdk.zh.md: 354d6829dc07056556d19ddfca68a95ad3a5b47f
python-sdk.md: 388b259f0adbba11b7d359fcf861980cf0a3bec7
python-sdk.zh.md: 2cc23e5cd1d7d7df5ad4b27441c54e6c3239c917
+43
View File
@@ -14,6 +14,8 @@ This tutorial installs the published Python SDK, runs the shipped standalone min
## Install the SDK
### Linux and macOS
```sh
git clone https://github.com/deepseek-ai/deepseek-harness.git
cd deepseek-harness
@@ -22,19 +24,40 @@ python -m venv .venv
python -m pip install deepseek-harness-sdk
```
### Windows PowerShell
```powershell
git clone https://github.com/deepseek-ai/deepseek-harness.git
Set-Location deepseek-harness
py -3.10 -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install deepseek-harness-sdk
```
The installation includes a matching native runtime wheel and the `dsh` command. Normal SDK execution needs no system Node.js. Repository contributors who build the artifacts should use the [Python contributor workflow](../../../python/development.md).
## Run the checked-in example
Export the credential and, when needed, a compatible proxy endpoint:
### Linux and macOS
```sh
export DEEPSEEK_API_KEY=sk-your-key-here
# export DEEPSEEK_BASE_URL=http://127.0.0.1:8000/v1
```
### Windows PowerShell
```powershell
$env:DEEPSEEK_API_KEY = "sk-your-key-here"
# $env:DEEPSEEK_BASE_URL = "http://127.0.0.1:8000/v1"
```
Run one task with explicit workspace and home paths:
### Linux and macOS
```sh
python examples/python-sdk-agent/minimal.py \
--workspace /absolute/path/to/disposable-workspace \
@@ -43,6 +66,16 @@ python examples/python-sdk-agent/minimal.py \
"Inspect the repository and fix the failing tests."
```
### Windows PowerShell
```powershell
python examples/python-sdk-agent/minimal.py `
--workspace C:\work\disposable-workspace `
--dsh-home C:\work\example-dsh-home `
--session-id example-001 `
"Inspect the repository and fix the failing tests."
```
The script prints the final assistant response. The selected home receives the generated `sdk-minimal` profile, installed plugins, and uncompressed JSONL session logs under `sessions/`. The example and SDK never silently read `~/.dsh`.
## Use the SDK in your program
@@ -76,12 +109,22 @@ The SDK starts the bundled `dsh --profile sdk-minimal` process lazily and reuses
Use `dsh plugin` for dependencies and bundle layers that should persist in this home:
### Linux and macOS
```sh
export DSH_HOME=/absolute/path/to/example-dsh-home
dsh --profile sdk-minimal --dump-default-config >/dev/null
dsh plugin --profile sdk-minimal add file:/absolute/path/to/my-plugin-bundle
```
### Windows PowerShell
```powershell
$env:DSH_HOME = "C:\work\example-dsh-home"
dsh --profile sdk-minimal --dump-default-config | Out-Null
dsh plugin --profile sdk-minimal add file:C:/work/my-plugin-bundle
```
The first command initializes the shipped standalone profile. The second forwards package management to `pnpm`, then records any installed package that exports a `dsh.bundle` layer. Install `pnpm` only for this management command; launching the installed SDK does not need it. Edit `$DSH_HOME/profiles/sdk-minimal/cordis.patch.yml` for persistent row changes, or pass patch files from Python for per-launch changes.
Another `profile` is valid when it includes `@deepseek-ai/dsh-sdk-app` or another JSON-RPC server row. Missing server rows, unresolved plugins, and invalid patches fail during startup instead of falling back to another composition.
+43
View File
@@ -14,6 +14,8 @@
## 安装 SDK
### Linux 与 macOS
```sh
git clone https://github.com/deepseek-ai/deepseek-harness.git
cd deepseek-harness
@@ -22,19 +24,40 @@ python -m venv .venv
python -m pip install deepseek-harness-sdk
```
### Windows PowerShell
```powershell
git clone https://github.com/deepseek-ai/deepseek-harness.git
Set-Location deepseek-harness
py -3.10 -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install deepseek-harness-sdk
```
安装内容包含匹配的原生运行时 wheel 与 `dsh` 命令。普通 SDK 运行不需要系统 Node.js。需要构建产物的仓库贡献者应使用 [Python 贡献者工作流](../../../python/development.zh.md)。
## 运行检入示例
导出凭据;使用兼容代理时再设置 endpoint:
### Linux 与 macOS
```sh
export DEEPSEEK_API_KEY=sk-your-key-here
# export DEEPSEEK_BASE_URL=http://127.0.0.1:8000/v1
```
### Windows PowerShell
```powershell
$env:DEEPSEEK_API_KEY = "sk-your-key-here"
# $env:DEEPSEEK_BASE_URL = "http://127.0.0.1:8000/v1"
```
使用显式 workspace 与 home 路径运行一个任务:
### Linux 与 macOS
```sh
python examples/python-sdk-agent/minimal.py \
--workspace /absolute/path/to/disposable-workspace \
@@ -43,6 +66,16 @@ python examples/python-sdk-agent/minimal.py \
"Inspect the repository and fix the failing tests."
```
### Windows PowerShell
```powershell
python examples/python-sdk-agent/minimal.py `
--workspace C:\work\disposable-workspace `
--dsh-home C:\work\example-dsh-home `
--session-id example-001 `
"Inspect the repository and fix the failing tests."
```
脚本会打印最终 assistant 响应。所选 home 会保存生成的 `sdk-minimal` profile、已安装插件,以及 `sessions/` 下的未压缩 JSONL 会话日志。示例与 SDK 绝不会静默读取 `~/.dsh`
## 在程序中使用 SDK
@@ -76,12 +109,22 @@ SDK 会延迟启动内置的 `dsh --profile sdk-minimal` 进程,并复用到
需要在该 home 中持久保存依赖与 bundle 层时,使用 `dsh plugin`
### Linux 与 macOS
```sh
export DSH_HOME=/absolute/path/to/example-dsh-home
dsh --profile sdk-minimal --dump-default-config >/dev/null
dsh plugin --profile sdk-minimal add file:/absolute/path/to/my-plugin-bundle
```
### Windows PowerShell
```powershell
$env:DSH_HOME = "C:\work\example-dsh-home"
dsh --profile sdk-minimal --dump-default-config | Out-Null
dsh plugin --profile sdk-minimal add file:C:/work/my-plugin-bundle
```
第一个命令初始化随附的独立 profile。第二个命令把包管理转发给 `pnpm`,然后记录所有导出 `dsh.bundle` 层的已安装包。只有执行此管理命令时才需要安装 `pnpm`;启动已安装 SDK 不需要它。持久配置项变更应编辑 `$DSH_HOME/profiles/sdk-minimal/cordis.patch.yml`;单次启动变更则从 Python 传入 patch 文件。
另一个 `profile` 只有包含 `@deepseek-ai/dsh-sdk-app` 或另一个 JSON-RPC server 配置项时才有效。缺失 server 配置项、无法解析的插件和非法 patch 会在启动时失败,不会回退到其他组合。