Conversation
Add pypy3.11 (testing) into `tests.yml` Remove py3.9 from matrix in `tests.yml` Refactor not auto-gen code to be compatible with py3.10+, droping ugly 3.9 annotation. Replace some `from typing` imports to `from collections.abc`, due to deprecation Add `from __future__ import annotations` and `if TYPE_CHECKING:` where possible Add some `noqa` to calm down Ruff in some places, if Ruff will be used as default linting+formatting tool in future Replace some relative imports to absolute Sort `__all__` tuples in `__init__.py` and some other `.py` files Sort `__slots__` tuples in classes Split raises into `msg` and `raise` (`EM101`, `EM102`) to not duplicate error message in the traceback Add `Self` from `typing_extenstion` where possible Resolve typing problem in `aiogram/filters/command.py:18` Concatenate nested `if` statements Convert `HandlerContainer` into a dataclass in `aiogram/fsm/scene.py` Bump tests docker-compose.yml `redis:6-alpine` -> `redis:8-alpine` Bump tests docker-compose.yml `mongo:7.0.6` -> `mongo:8.0.14` Bump pre-commit-config `black==24.4.2` -> `black==25.9.0` Bump pre-commit-config `ruff==0.5.1` -> `ruff==0.13.3` Update Makefile lint for ruff to show fixes Add `make outdated` into Makefile Use `pathlib` instead of `os.path` Bump `redis[hiredis]>=5.0.1,<5.3.0` -> `redis[hiredis]>=6.2.0,<7` Bump `cryptography>=43.0.0` -> `cryptography>=46.0.0` due to security reasons Bump `pytz~=2023.3` -> `pytz~=2025.2` Bump `pycryptodomex~=3.19.0` -> `pycryptodomex~=3.23.0` due to security reasons Bump linting and formatting tools
✔️ Changelog found.Thank you for adding a description of the changes |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev-3.x #1726 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 591 591
Lines 13876 13980 +104
==========================================
+ Hits 13876 13980 +104
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR removes support for Python 3.9 following its end-of-life status and updates the codebase to use Python 3.10+ type annotations and features. The changes modernize type hints by replacing generic types from the typing module with built-in equivalents (e.g., List → list, Dict → dict), add from __future__ import annotations where appropriate, and update dependencies for security and compatibility reasons.
Key changes include:
- Drop Python 3.9 support and update minimum requirement to Python 3.10
- Modernize type annotations throughout the codebase
- Update dependencies including Redis, cryptography, and development tools
Reviewed Changes
Copilot reviewed 94 out of 94 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Updates Python version requirements, dependency versions, and build configuration |
| tests/test_utils/test_dataclass.py | Removes Python 3.9 test cases |
| tests/docker-compose.yml | Updates Redis and MongoDB versions, removes version specification |
| .github/workflows/tests.yml | Removes Python 3.9 from test matrix, adds PyPy 3.11 |
| examples/*.py | Adds return type annotations and modernizes type hints |
| aiogram/**/*.py | Comprehensive type annotation modernization and code refactoring |
| README.rst | Updates Python version requirement in documentation |
| Makefile | Adds ruff linting options and outdated dependency checker |
| .pre-commit-config.yaml | Updates black and ruff versions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Due to EOL of Py3.9 - this PR is presented.
Enums, types, methods or
Botclass not changed,Butchermust be reconfigured to auto-generate py3.10+ compatible code.Changes:
tests.ymltests.ymlfrom typingimports tofrom collections.abc, due to deprecationfrom __future__ import annotationsandif TYPE_CHECKING:where possiblenoqato calm down Ruff in some places, if Ruff will be used as default linting+formatting tool in future__all__tuples in__init__.pyand some other.pyfiles__slots__tuples in classesmsgandraise(EM101,EM102) to not duplicate error message in the tracebackSelffromtyping_extenstionwhere possibleaiogram/filters/command.py:18ifstatementsHandlerContainerinto a dataclass inaiogram/fsm/scene.pyredis:6-alpine->redis:8-alpinemongo:7.0.6->mongo:8.0.14black==24.4.2->black==25.9.0ruff==0.5.1->ruff==0.13.3pathlibinstead ofos.pathredis[hiredis]>=5.0.1,<5.3.0->redis[hiredis]>=6.2.0,<7cryptography>=43.0.0->cryptography>=46.0.0due to security reasonspytz~=2023.3->pytz~=2025.2pycryptodomex~=3.19.0->pycryptodomex~=3.23.0due to security reasonsType of change