Skip to content

Commit f690db9

Browse files
SummerOneTwoclaude
andcommitted
fix: 降低 Python 版本要求至 3.10
问题: - 项目要求 Python 3.14(未发布版本),用户无法正常安装 - 代码实际只使用了 Python 3.10 的特性(X | None 类型注解) 修改: - pyproject.toml: requires-python、ruff/mypy target 改为 3.10 - CI 配置: python-version 改为 "3.10" - README/README_CN: 文档中的版本要求改为 3.10+ 额外修复: - interactor.py: 修复 Python 2 风格的异常捕获语法(需括号) - base.py/win_job.py: 添加 __future__ annotations 支持自引用类型 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4235775 commit f690db9

8 files changed

Lines changed: 535 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v4
1414
- uses: actions/setup-python@v5
1515
with:
16-
python-version: "3.14"
16+
python-version: "3.10"
1717
- uses: astral-sh/setup-uv@v4
1818
with:
1919
enable-cache: true
@@ -26,7 +26,7 @@ jobs:
2626
- uses: actions/checkout@v4
2727
- uses: actions/setup-python@v5
2828
with:
29-
python-version: "3.14"
29+
python-version: "3.10"
3030
- uses: astral-sh/setup-uv@v4
3131
with:
3232
enable-cache: true
@@ -62,7 +62,7 @@ jobs:
6262
- uses: actions/checkout@v4
6363
- uses: actions/setup-python@v5
6464
with:
65-
python-version: "3.14"
65+
python-version: "3.10"
6666
- uses: astral-sh/setup-uv@v4
6767
with:
6868
enable-cache: true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ uv sync
4646

4747
### Prerequisites
4848

49-
- **Python 3.14+**
49+
- **Python 3.10+**
5050
- **g++ compiler** with C++20 support (GCC 10+ recommended)
5151
- **testlib.h** (included in templates/)
5252

README_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ uv sync
4646

4747
### 前置要求
4848

49-
- **Python 3.14+**
49+
- **Python 3.10+**
5050
- **g++ 编译器**,支持 C++20(推荐 GCC 10+)
5151
- **testlib.h**(已包含在 templates/ 目录)
5252

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "autocode-mcp"
33
version = "0.1.0"
44
description = "MCP Server for competitive programming problem creation, based on AutoCode paper"
55
readme = "README.md"
6-
requires-python = ">=3.14"
6+
requires-python = ">=3.10"
77
dependencies = [
88
"mcp>=1.0.0",
99
"pydantic>=2.0.0",
@@ -38,7 +38,7 @@ markers = ["integration: marks tests as integration tests (deselect with '-m \"n
3838

3939
[tool.ruff]
4040
line-length = 100
41-
target-version = "py314"
41+
target-version = "py310"
4242

4343
[tool.ruff.lint]
4444
select = ["E", "F", "W", "I", "N", "UP", "B", "C4"]
@@ -48,7 +48,7 @@ ignore = ["E501"]
4848
known-first-party = ["autocode_mcp"]
4949

5050
[tool.mypy]
51-
python_version = "3.14"
51+
python_version = "3.10"
5252
strict = true
5353
warn_return_any = true
5454
warn_unused_ignores = true

src/autocode_mcp/tools/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
工具基类和统一返回值格式。
33
"""
44

5+
from __future__ import annotations
6+
57
from abc import ABC, abstractmethod
68
from dataclasses import dataclass, field
79
from typing import Any

src/autocode_mcp/tools/interactor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ async def pipe_data(reader, writer, name: str):
261261
break
262262
writer.write(data)
263263
await writer.drain()
264-
except asyncio.CancelledError, ConnectionResetError, BrokenPipeError, OSError:
264+
except (asyncio.CancelledError, ConnectionResetError, BrokenPipeError, OSError):
265265
pass
266266

267267
pipe_tasks = []
@@ -298,11 +298,11 @@ async def pipe_data(reader, writer, name: str):
298298
if proc.returncode is None:
299299
try:
300300
proc.kill()
301-
except ProcessLookupError, OSError:
301+
except (ProcessLookupError, OSError):
302302
pass
303303
try:
304304
await asyncio.wait_for(proc.wait(), timeout=2)
305-
except TimeoutError, OSError:
305+
except (TimeoutError, OSError):
306306
pass
307307

308308
# 根据交互器退出码判断结果

src/autocode_mcp/utils/win_job.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
仅在 Windows 平台上可用,其他平台会抛出 RuntimeError。
66
"""
77

8+
from __future__ import annotations
9+
810
import sys
911
from typing import TYPE_CHECKING
1012

uv.lock

Lines changed: 520 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)