Skip to content

Remove: 移除 Python 3.10 支持 - #4219

Open
shoucandanghehe wants to merge 2 commits into
nonebot:masterfrom
shoucandanghehe:chore/drop-3.10
Open

shoucandanghehe wants to merge 2 commits into
nonebot:masterfrom
shoucandanghehe:chore/drop-3.10

Conversation

@shoucandanghehe

Copy link
Copy Markdown
Member

修改内容

  • 将最低 Python 版本提升至 3.11,同步测试矩阵、Pyright 配置、README 和当前开发版文档。
  • 使用标准库 tomllib,移除 tomli 回退和直接依赖,以及不再使用的 Python 3.10 覆盖率规则。
  • 通过 Ruff 自动修复迁移至 typing.Self 和 datetime.UTC,使用内置 BaseExceptionGroup。
  • 重新生成 uv.lock,移除仅旧 Python 版本需要的依赖和发行包记录,不升级现存依赖。
  • 删除当前文档中不再适用的旧 Python 示例页签;保留版本化历史文档和独立发布的 docs 插件原有支持范围。

兼容性说明

此改动不再支持 Python 3.10,用户需要升级至 Python 3.11 或更高版本。

仍保留 exceptiongroup:Python 3.11 的 contextlib.suppress 不支持异常组,生命周期退出仍使用其回移植实现。既有 catch 行为保持不变。

仍保留 typing_extensions:Python 3.11 仍需要 override、TypeAliasType;扩展版 TypedDict 的识别需要扩展版 is_typeddict。

CacheState 保留原枚举格式,避免升级 StrEnum 改变已有缓存状态错误文本。

验证

  • Ruff 检查、格式检查和 git diff --check 通过。
  • uv lock --check --python 3.11 通过。
  • Python 3.11 下,Pydantic v1/v2 的依赖注入、规则、权限、适配器、插件加载、配置、驱动生命周期和类型兼容相关测试通过;内置异常组迁移后的复验分别为 288 passed、14 skipped。
  • Wheel 构建及元数据检查通过;安装器 dry-run 在 Python 3.10 下明确拒绝,在 Python 3.11 下成功解析。
  • 改动 MDX 文件编译通过;真实浏览器验证当前开发版文档的示例、版本要求和保留的 Annotated 页签交互正常。
  • Pyright 1.1.414 完整检查全部 119 个跟踪 Python 文件:Pydantic v1/v2 均为 3 条错误、1 条警告,全部在各自独立依赖环境的上游基线复现,无新增诊断;没有将此检查标为通过。
  • GitHub CI 和其他操作系统矩阵尚未执行。

参考

@shoucandanghehe
shoucandanghehe marked this pull request as draft October 13, 2026 15:50
@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.91%. Comparing base (e363ec9) to head (11d0dfc).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4219      +/-   ##
==========================================
- Coverage   93.98%   93.91%   -0.08%     
==========================================
  Files          49       49              
  Lines        4541     4534       -7     
==========================================
- Hits         4268     4258      -10     
- Misses        273      276       +3     
Flag Coverage Δ
unittests 93.91% <100.00%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Deployed to https://deploy-preview-4219--nonebot2.netlify.app

@shoucandanghehe
shoucandanghehe marked this pull request as ready for review October 13, 2026 16:04
@yanyongyu yanyongyu added the Breaking Breaking change label Oct 14, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking Breaking change

Development

Successfully merging this pull request may close these issues.

2 participants