Skip to content

fix(deps): declare sqlalchemy[asyncio] extra for greenlet compatibility - #528

Draft
liujuanjuan1984 wants to merge 1 commit into
mainfrom
fix/ci-pr-527
Draft

liujuanjuan1984 wants to merge 1 commit into
mainfrom
fix/ci-pr-527

Conversation

@liujuanjuan1984

Copy link
Copy Markdown
Collaborator

CI 修复:wheel 冒烟测试因 SQLAlchemy 2.1 缺失 greenlet 而失败

根因(来自真实 CI 日志)

  • dependabot PR deps: bump the uv-all-updates group with 3 updates #527 的 Validate Default Toolchain 检查在 Smoke test built wheel 步骤失败:冒烟脚本以 uv tool install <wheel> 安装构建产物(不带仓库 uv.lock / constraint-dependencies),解析到 2026-09-24 发布的 SQLAlchemy 2.1.0。
  • SQLAlchemy 2.1 将 greenlet 改为可选依赖,asyncio 用法必须显式声明 sqlalchemy[asyncio]。服务启动时抛出:
    ImportError: The SQLAlchemy asyncio module requires that the Python 'greenlet' library is installed.
    → Application startup failed. Exiting. → /health 健康检查失败。
  • 仓库 dev 环境(uv.lock)此前锁定 sqlalchemy 2.0.x,测试与 Runtime Matrix 均通过,仅冒烟测试路径暴露此问题。

修复

  • pyproject.toml 项目依赖声明由 sqlalchemy>=2.0,<3.0 改为 sqlalchemy[asyncio]>=2.0,<3.0,使 greenlet 进入 wheel 元数据,覆盖所有安装路径(包括不读 lock 的 uv tool install 冒烟路径)。
  • 同步刷新 uv.lock(因合并了上游 deps: bump the uv-all-updates group with 3 updates #526 的 uv-all-updates 组更新而重新解析)。

本地验证

  • uv build --no-sources 构建 wheel,METADATA 确认为 Requires-Dist: sqlalchemy[asyncio]<3.0,>=2.0。
  • bash ./scripts/smoke_test_built_cli.sh dist/*.whl 通过:安装 sqlalchemy 2.1.1 + greenlet 3.5.6,服务正常启动并通过 /health 检查(即 CI 失败的同一场景)。
  • ./scripts/doctor.sh 全绿(exit 0)。

关联

SQLAlchemy 2.1 (released 2026-09-24) made greenlet an optional dependency, so asyncio usage now requires the explicit sqlalchemy[asyncio] install target. The wheel smoke test installs the built wheel without repository constraints and picked up sqlalchemy 2.1.1, causing 'ImportError: The SQLAlchemy asyncio module requires that the Python greenlet library is installed.' during server startup (opencode-a2a#527 CI failure on Validate Default Toolchain / Smoke test built wheel). Declaring the extra in project dependencies carries greenlet into the wheel metadata for all install paths. Verified locally: uv build + scripts/smoke_test_built_cli.sh passes with sqlalchemy 2.1.1 + greenlet 3.5.6, and ./scripts/doctor.sh is green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant