release(v0.15.1): 上限 typer<0.26(修复 vendored click 致 CLI 崩溃)#1
Merged
Conversation
Typer 0.26.0 把 click 硬 fork 成 vendored 副本(typer/_click/)并删掉对 独立 click 的依赖。本仓库 _DeepTradeGroup 继承 typer.core.TyperGroup,同时 db_cmd / 插件 pass-through 又直接用独立 click(click.Context / @click.command / @click.pass_context)。两个 click 是不同的类,Typer 构建命令树时识别不出 独立的 click.core.Context context 形参,报 "Type not yet supported: <class click.core.Context>",导致任意子命令启动即崩(用户实测 plugin upgrade)。 dev/CI 未暴露是因为 uv.lock 锁定 typer 0.25.0;只有 pipx 等按 typer>=0.12 重新解析的环境会拉到 0.26.2。 收紧约束为 typer>=0.12,<0.26,恢复 Typer 与仓库共用同一个 click 的不变量。 顺带修复 README 版本徽章(v0.15.0 漏更,仍停在 0.14.0),test_version_consistency 现已对齐 0.15.1。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
v0.15.1 发布时踩到:tests/test_version_consistency.py 还校验 README 徽章, 但 CLAUDE.md 只写了 pyproject + __init__.py 两处,导致 v0.15.0 把徽章漏在 0.14.0、本次 pytest 才暴露。补全为三处并更新 grep 命令与发布步骤。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
deeptrade任意命令启动即崩(用户实测plugin upgrade):根因:Typer 0.26.0 把 click 硬 fork 成自带的 vendored 副本(
typer/_click/),并从依赖里删掉了对独立click的声明。本仓库的 CLI 设计同时用了两边——cli.py::_DeepTradeGroup继承typer.core.TyperGroup(>=0.26 走 vendored click),而db_cmd(ctx: click.Context)/ 插件 pass-through 的裸@click.command/@click.pass_context用的是独立click。两个 click 是两个不同的类;Typer 构建命令树时用lenient_issubclass(param.annotation, typer._click.Context)识别 context 形参,独立的click.core.Context识别不出来 → 当成普通 CLI 参数 → 报错。这会让整棵命令树构建失败。dev/CI 没暴露是因为
uv.lock锁定 typer 0.25.0(最后一个未 vendor、仍click>=8.2.1的版本);只有pipx install这类按typer>=0.12重新解析的环境会拉到 0.26.2。改动
pyproject.toml:typer>=0.12→typer>=0.12,<0.26,恢复"Typer 与仓库共用同一个 click"的不变量(同时堵住插件分发返回独立-click 命令的潜伏 bug)。pyproject.toml/deeptrade/__init__.py/ README 徽章(v0.15.0 漏更,仍停在 0.14.0)。CHANGELOG.md新增[v0.15.1]条目(含pipx runpip deeptrade-quant install "typer<0.26"临时自救)。uv.lock重新锁定。验证
本地 release gate 全绿:
ruff check✓ /mypy deeptrade✓ /pytest -m "not manual"(623 passed)✓ /python -m build(产出正确命名的0.15.1wheel + sdist)✓。🤖 Generated with Claude Code