fix: address Python release review feedback

This commit is contained in:
Yichen Jiang
2026-08-11 20:09:33 +08:00
parent bc51510a77
commit 49768e1f8d
30 changed files with 318 additions and 92 deletions

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 python/sdk/README.md
README.md: 649dbed7afa0f11177f87984033aa58ac7d8ac2e
README.zh.md: 75e6ba91152af527395fa53903e53fd0d056bdb5
README.md: 0f91f3d9b5e770852a0c1e638b1506a14b8d65c0
README.zh.md: a3adb241f5d27b49ecab2f1541dfd9775a34a24f

View File

@@ -1,6 +1,6 @@
# DeepSeek Harness Python SDK
English | [中文](README.zh.md)
English | [中文](https://github.com/deepseek-ai/deepseek-harness/blob/master/python/sdk/README.zh.md)
Python subprocess SDK for driving DeepSeek Harness over JSON-RPC stdio. The
runtime inherits normal DeepSeek Harness environment variables such as

View File

@@ -1,6 +1,6 @@
# DeepSeek Harness Python SDK
[English](README.md) | 中文
[English](https://github.com/deepseek-ai/deepseek-harness/blob/master/python/sdk/README.md) | 中文
通过 JSON-RPC stdio 驱动 DeepSeek Harness 的 Python 子进程 SDK。运行时继承常规的 DeepSeek Harness 环境变量(如 `DEEPSEEK_BASE_URL``DEEPSEEK_API_KEY`),调用方可以直接使用真实模型端点,也可以把这些变量指向本地代理。

View File

@@ -0,0 +1,37 @@
"""Tests for macOS runtime wheel deployment-target validation."""
from __future__ import annotations
import runpy
from pathlib import Path
from types import SimpleNamespace
import pytest
ROOT = Path(__file__).resolve().parents[3]
SCRIPT = ROOT / "scripts" / "check-macos-deployment-target.py"
checker = SimpleNamespace(**runpy.run_path(str(SCRIPT)))
def test_otool_parser_uses_the_newest_macho_slice() -> None:
output = """
cmd LC_BUILD_VERSION
minos 11.0
cmd LC_BUILD_VERSION
minos 13.5
"""
assert checker.parse_otool_deployment_target(output) == (13, 5)
def test_otool_parser_requires_a_deployment_target() -> None:
with pytest.raises(ValueError, match="contains no LC_BUILD_VERSION"):
checker.parse_otool_deployment_target("Load command 0\n")
def test_wheel_tag_rejects_a_newer_executable_target() -> None:
checker.ensure_compatible(Path("runtime"), (13, 5), "macosx_14_0_arm64")
with pytest.raises(RuntimeError, match="requires macOS 14.1"):
checker.ensure_compatible(Path("spawn-helper"), (14, 1), "macosx_14_0_arm64")

View File

@@ -61,6 +61,14 @@ def test_macos_wheel_tag_does_not_claim_unsupported_node_platforms() -> None:
assert build_python_release.PLATFORMS["macos-arm64"][0] == "macosx_14_0_arm64"
def test_platform_manifest_rejects_incomplete_entries(tmp_path: Path) -> None:
manifest = tmp_path / "platforms.json"
manifest.write_text('{"macos-arm64":{"tag":"macosx_14_0_arm64"}}\n')
with pytest.raises(ValueError, match="tag and executable fields"):
build_python_release.load_platforms(manifest)
def test_stage_sdk_keeps_distribution_module_and_runtime_pin_distinct(tmp_path: Path) -> None:
destination = tmp_path / "staging"
@@ -96,6 +104,9 @@ def test_stage_runtime_copies_platform_payload(
assert {path.name: path.read_bytes() for path in runtime_dir.glob("dsh-jsonrpc-agent-pkg-*")} == expected
pyproject = (destination / "pyproject.toml").read_text()
assert 'license-files = ["LICENSE", "THIRD_PARTY_NOTICES.md"]' in pyproject
assert (destination / "platforms.json").read_bytes() == (
ROOT / "python" / "sdk-runtime" / "platforms.json"
).read_bytes()
assert (destination / "LICENSE").read_bytes() == (ROOT / "LICENSE").read_bytes()
assert (destination / "THIRD_PARTY_NOTICES.md").read_bytes() == (
ROOT / "THIRD_PARTY_NOTICES.md"