* Drop py3.9 and pypy3.9
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
* Add `1726.removal.rst`
* Update aiogram/utils/dataclass.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update aiogram/filters/callback_data.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update 1726.removal.rst
* Remove `outdated` from Makefile
* Add `__slots__` to `HandlerContainer`
* Remove unused imports
* Add `@dataclass` with `slots=True` to `HandlerContainer`
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* migrated mongo storage from using deprecated motor to PyMongo
* added storages to __init__.py file to improve DX
* changelog file created
* Revert "added storages to __init__.py file to improve DX"
This reverts commit 5d0f6a9dfb.
* added optional dependency to pymongo to pyproject.toml
* Revert "migrated mongo storage from using deprecated motor to PyMongo"
This reverts commit 1c0207e1d1.
* added deprecation warning to mongo storage
* created pymongo storage
* added entry for PyMongoStorage to documentation in fsm.storages
* updated changelog to have information about how to migrate from MongoStorage to PyMongoStorage
* added test for pymongo storage (copied from mongo storage test)
* fixed formatting using black and isort
* fixed bug in close method of PyMongoStorage (client close method was not awaited)
* added test for PyMongoStorage that checks if storage could be properly closed
* pymongo package changed to be lower case in PyMongoStorage
* added fixture registration for pymongo storage
* test for pymongo is now using proper test fixtures
* removed redundant call to get_data, because we have checked this condition in the previous line
* added more tests to pymongo test, to check for all possible cases of using update_data method
* fixed PyMongoStorage update_data method implementation
* added pymongo tests to test_storages
* fixed pymongo tests, update_data method should not delete document when {} was passed
* Revert "fixed PyMongoStorage update_data method implementation"
This reverts commit 86170e1cb9.
* fixed linting issues in PyMongoStorage
* changed allowed versions of pymongo, to be compatible with motor
* pinned the upper version of pymongo to <4.11
* Add TypedDict support for middleware context data
Introduced `MiddlewareData` and associated TypedDicts to type-hint middleware context data. Updated documentation to include usage examples and guidelines for extending the default middleware data. Also adjusted coverage configuration to exclude the new data module.
* Added more docstrings
* Typo fixes
* Try to enable tests on Python 3.13
* Remove support for Python 3.8 and PyPy 3.8
Dropped Python 3.8 and PyPy 3.8 from the CI workflow and updated the minimum required Python version to 3.9 in pyproject.toml. Also updated dependencies and tools to align with the new minimum Python version.
* Added changelog
* Reformat code
* Bump mypy python version
* #1579 Fixed `Default` object annotation resolution in `pydantic` models. Reformat code.
* Bump mongo and Redis dependencies
* Update pydantic version constraints based on Python version
Adjusted the version constraints for the pydantic library in `pyproject.toml` to ensure compatibility with different Python versions. This helps maintain stability and compatibility across various development environments.
* Adjust version
* Fixed typo
* Mongo storage included to storages test
* Added few additional checks in storages test
* Added MongoStorage for FSM
* Added changes description
* Fixed error message syntax
Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
* Resolved mypy check error
* IF/ELSE statement simplified
* Fix ruff linter error: RET505 Unnecessary `elif` after `return` statement
* Fix ruff linter error: E501 Line too long (100 > 99)
* Added mongo storage testing in CI
* Refactoring while review
* Refactoring while review
* Storing FSM state and data together in MongoDB-storage
* Fix CI - MongoDB container action is only supported on Linux
* Refactoring while review
* Enable Macos in pypy-tests section of CI
* Refactoring while review
* Makefile updated
* redis and mongo storages tests do not run in pypy-tests job of CI
* Fix docstring of DefaultKeyBuilder
---------
Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
* Upgrade to py12 compatible aiohttp beta version
* Fix uvloop deprecation warning causing pytest not to run
* Fix test due to asyncio task scheduling race condition
* Fix test_state_in_unknown_class for Python 3.12+ due to PEP 678 changes
* Add Python 3.12 support in GitHub Actions and project configurations
* Add changelog entry
---------
Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
* #1320 Update pytest configuration and tests cleanup
This commit modifies the pytest's configuration file, `pyproject.toml`, to remove filterwarnings settings. It also makes changes in various test files; the Redis isolation test is now using the provided `redis_storage` fixture instead of setting up its own connection, pytest.mark.filterwarnings is no longer used in `test_isolation.py` and `test_aiohttp_session.py` properly closes off sessions.
* Added changelog
* Fixed coverage for the RedisEventIsolation
This commit changes the version requirements for typing-extensions in the dependencies section of pyproject.toml file. This change now requires versions that are greater than or equal to 4.7.0 and less than or equal to 5.0. The previous version, 4.8.0, has been found to cause compatibility issues with some other libraries.
* #1277 Replace datetime.datetime with DateTime across codebase
Replaced all instances of standard library 'datetime.datetime' with a new 'DateTime' type from `.custom` module. This change is necessary to make all date-time values compatible with the Telegram Bot API (it uses Unix time). This will simplify the conversion process and eliminate potential errors related to date-time format mismatches. Changed codebase, butcher files, and modified 'pyproject.toml' to shift the typing-extensions dependency. The 'aiogram/custom_types.py' file was renamed to 'aiogram/types/custom.py' to better reflect its nature as a location for custom types used in the aiogram library.