Skip to content

Remove: 移除 Python 3.9 支持#3860

Open
shoucandanghehe wants to merge 10 commits intononebot:masterfrom
shoucandanghehe:chore/drop-3.9
Open

Remove: 移除 Python 3.9 支持#3860
shoucandanghehe wants to merge 10 commits intononebot:masterfrom
shoucandanghehe:chore/drop-3.9

Conversation

@shoucandanghehe
Copy link
Member

No description provided.

@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 99.10714% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.76%. Comparing base (7a83fd0) to head (1c3a7c0).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
nonebot/internal/driver/model.py 96.15% 1 Missing ⚠️
nonebot/utils.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3860      +/-   ##
==========================================
- Coverage   93.83%   93.76%   -0.07%     
==========================================
  Files          48       48              
  Lines        4360     4349      -11     
==========================================
- Hits         4091     4078      -13     
- Misses        269      271       +2     
Flag Coverage Δ
unittests 93.76% <99.10%> (-0.07%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

@yanyongyu yanyongyu added enhancement New feature or request Breaking Breaking change labels Feb 13, 2026
@yanyongyu yanyongyu requested a review from Copilot February 13, 2026 12:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request removes Python 3.9 support from the codebase and migrates to Python 3.10+ type annotation syntax. The migration primarily involves replacing Union[X, Y] and Optional[X] with the PEP 604 union syntax X | Y and X | None, updating imports of Callable to use collections.abc, moving TypeAlias, get_args, and get_origin from typing_extensions to the typing module, and removing version-specific compatibility code.

Changes:

  • Updated minimum Python version requirement from 3.9 to 3.10 in pyproject.toml and removed Python 3.9 from CI/CD test matrix
  • Migrated type annotations throughout the codebase to use PEP 604 union syntax (X | Y instead of Union[X, Y])
  • Updated import statements to use Python 3.10+ standard library locations for Callable, TypeAlias, get_args, and get_origin
  • Removed version compatibility checks for Python 3.9 and simplified NONE_TYPES constant

Reviewed changes

Copilot reviewed 55 out of 56 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
pyproject.toml Updated Python version requirement to >=3.10 and updated ruff/pyright target versions
.github/workflows/codecov.yml Removed Python 3.9 from test matrix
nonebot/typing.py Removed sys.version_info checks for Python 3.9, moved TypeAlias/get_args/get_origin to typing, updated NONE_TYPES
nonebot/utils.py Migrated Union/Optional to new syntax, moved Callable import to collections.abc
nonebot/rule.py Migrated type annotations to new union syntax, removed Optional/Union imports
nonebot/plugin/on.py Migrated type annotations to new union syntax, removed Union import
nonebot/plugin/model.py Migrated Optional annotations to new syntax
nonebot/plugin/manager.py Migrated Optional annotations to new syntax, removed Optional import
nonebot/plugin/load.py Migrated Union/Optional annotations to new syntax, removed imports
nonebot/plugin/init.py Migrated Optional annotations to new syntax
nonebot/params.py Migrated type annotations, moved Callable import, removed Union import
nonebot/message.py Migrated type annotations, moved Callable import, removed Union/Optional imports
nonebot/internal/rule.py Partially migrated - still has mixed Union usage
nonebot/internal/permission.py Partially migrated - still has mixed Union usage
nonebot/internal/params.py Mostly migrated but retains Optional import for legacy usage
nonebot/internal/matcher/matcher.py Migrated type annotations, removed Union import
nonebot/internal/matcher/manager.py Migrated Union annotations, removed Union import from typing
nonebot/internal/driver/model.py Partially migrated - still uses Union for forward references
nonebot/internal/driver/combine.py Migrated Union annotations, removed Union import
nonebot/internal/driver/abstract.py Migrated Union annotations, moved TypeAlias, removed Union import
nonebot/internal/driver/_lifespan.py Migrated type annotations, moved Callable/TypeAlias, removed Union import
nonebot/internal/adapter/template.py Migrated type annotations, moved Callable/TypeAlias, removed Optional/Union imports
nonebot/internal/adapter/message.py Migrated type annotations, removed Optional/Union imports
nonebot/internal/adapter/bot.py Updated one annotation to new syntax (exception type)
nonebot/exception.py Migrated Optional annotations, removed Optional import
nonebot/drivers/* Migrated type annotations, moved Callable imports, removed Union/Optional imports
nonebot/dependencies/* Migrated type annotations, moved Callable import
nonebot/config.py Migrated type annotations, moved TypeAlias, removed Union/Optional imports
nonebot/compat.py Migrated type annotations, moved Callable import, removed Optional/Union imports
nonebot/init.py Migrated type annotations, removed Optional/Union imports
tests/* Migrated type annotations, removed Union/Optional imports, added test for new syntax

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 55 out of 56 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

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

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

Labels

Breaking Breaking change enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

2 participants