aiomax2 0.1.0a2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. aiomax2-0.1.0a2/.github/ISSUE_TEMPLATE/bug_report.yml +41 -0
  2. aiomax2-0.1.0a2/.github/ISSUE_TEMPLATE/feature_request.yml +24 -0
  3. aiomax2-0.1.0a2/.github/pull_request_template.md +17 -0
  4. aiomax2-0.1.0a2/.github/workflows/ci.yml +24 -0
  5. aiomax2-0.1.0a2/.github/workflows/docs.yml +50 -0
  6. aiomax2-0.1.0a2/.gitignore +61 -0
  7. aiomax2-0.1.0a2/CHANGELOG.md +65 -0
  8. aiomax2-0.1.0a2/CONTRIBUTING.md +40 -0
  9. aiomax2-0.1.0a2/LICENSE +22 -0
  10. aiomax2-0.1.0a2/PKG-INFO +802 -0
  11. aiomax2-0.1.0a2/README.md +769 -0
  12. aiomax2-0.1.0a2/SECURITY.md +32 -0
  13. aiomax2-0.1.0a2/docs/api-coverage.md +50 -0
  14. aiomax2-0.1.0a2/docs/architecture.md +64 -0
  15. aiomax2-0.1.0a2/docs/callbacks.md +76 -0
  16. aiomax2-0.1.0a2/docs/certificates.md +122 -0
  17. aiomax2-0.1.0a2/docs/commands.md +37 -0
  18. aiomax2-0.1.0a2/docs/errors.md +45 -0
  19. aiomax2-0.1.0a2/docs/filters.md +38 -0
  20. aiomax2-0.1.0a2/docs/formatting.md +76 -0
  21. aiomax2-0.1.0a2/docs/fsm.md +60 -0
  22. aiomax2-0.1.0a2/docs/handlers.md +45 -0
  23. aiomax2-0.1.0a2/docs/index.md +38 -0
  24. aiomax2-0.1.0a2/docs/installation.md +95 -0
  25. aiomax2-0.1.0a2/docs/keyboards.md +153 -0
  26. aiomax2-0.1.0a2/docs/magic-filter.md +41 -0
  27. aiomax2-0.1.0a2/docs/middleware.md +55 -0
  28. aiomax2-0.1.0a2/docs/migration-from-aiogram.md +126 -0
  29. aiomax2-0.1.0a2/docs/polling.md +67 -0
  30. aiomax2-0.1.0a2/docs/quickstart.md +93 -0
  31. aiomax2-0.1.0a2/docs/rate-limits.md +84 -0
  32. aiomax2-0.1.0a2/docs/research.md +77 -0
  33. aiomax2-0.1.0a2/docs/roadmap.md +45 -0
  34. aiomax2-0.1.0a2/docs/router.md +76 -0
  35. aiomax2-0.1.0a2/docs/subscriptions.md +37 -0
  36. aiomax2-0.1.0a2/docs/uploads.md +75 -0
  37. aiomax2-0.1.0a2/docs/webhook.md +170 -0
  38. aiomax2-0.1.0a2/examples/README.md +63 -0
  39. aiomax2-0.1.0a2/examples/basic_bot.py +29 -0
  40. aiomax2-0.1.0a2/examples/callbacks.py +42 -0
  41. aiomax2-0.1.0a2/examples/commands.py +29 -0
  42. aiomax2-0.1.0a2/examples/comments.py +26 -0
  43. aiomax2-0.1.0a2/examples/custom_ca.py +19 -0
  44. aiomax2-0.1.0a2/examples/custom_session.py +25 -0
  45. aiomax2-0.1.0a2/examples/errors.py +23 -0
  46. aiomax2-0.1.0a2/examples/fastapi_webhook.py +50 -0
  47. aiomax2-0.1.0a2/examples/filters.py +33 -0
  48. aiomax2-0.1.0a2/examples/formatting.py +46 -0
  49. aiomax2-0.1.0a2/examples/fsm.py +51 -0
  50. aiomax2-0.1.0a2/examples/keyboards.py +61 -0
  51. aiomax2-0.1.0a2/examples/message_actions.py +28 -0
  52. aiomax2-0.1.0a2/examples/middleware.py +43 -0
  53. aiomax2-0.1.0a2/examples/modes.py +75 -0
  54. aiomax2-0.1.0a2/examples/routers.py +41 -0
  55. aiomax2-0.1.0a2/examples/send_action.py +29 -0
  56. aiomax2-0.1.0a2/examples/subscriptions.py +26 -0
  57. aiomax2-0.1.0a2/examples/uploads.py +57 -0
  58. aiomax2-0.1.0a2/mkdocs.yml +58 -0
  59. aiomax2-0.1.0a2/pyproject.toml +74 -0
  60. aiomax2-0.1.0a2/src/aiomax2/__init__.py +16 -0
  61. aiomax2-0.1.0a2/src/aiomax2/bot.py +829 -0
  62. aiomax2-0.1.0a2/src/aiomax2/client/__init__.py +4 -0
  63. aiomax2-0.1.0a2/src/aiomax2/client/rate_limiter.py +87 -0
  64. aiomax2-0.1.0a2/src/aiomax2/client/session.py +349 -0
  65. aiomax2-0.1.0a2/src/aiomax2/dispatcher/__init__.py +14 -0
  66. aiomax2-0.1.0a2/src/aiomax2/dispatcher/dispatcher.py +197 -0
  67. aiomax2-0.1.0a2/src/aiomax2/dispatcher/event.py +113 -0
  68. aiomax2-0.1.0a2/src/aiomax2/dispatcher/invoke.py +97 -0
  69. aiomax2-0.1.0a2/src/aiomax2/dispatcher/middleware.py +65 -0
  70. aiomax2-0.1.0a2/src/aiomax2/dispatcher/router.py +143 -0
  71. aiomax2-0.1.0a2/src/aiomax2/enums.py +99 -0
  72. aiomax2-0.1.0a2/src/aiomax2/exceptions.py +98 -0
  73. aiomax2-0.1.0a2/src/aiomax2/filters/__init__.py +14 -0
  74. aiomax2-0.1.0a2/src/aiomax2/filters/base.py +10 -0
  75. aiomax2-0.1.0a2/src/aiomax2/filters/command.py +62 -0
  76. aiomax2-0.1.0a2/src/aiomax2/filters/magic.py +136 -0
  77. aiomax2-0.1.0a2/src/aiomax2/filters/state.py +19 -0
  78. aiomax2-0.1.0a2/src/aiomax2/fsm/__init__.py +14 -0
  79. aiomax2-0.1.0a2/src/aiomax2/fsm/context.py +36 -0
  80. aiomax2-0.1.0a2/src/aiomax2/fsm/state.py +51 -0
  81. aiomax2-0.1.0a2/src/aiomax2/fsm/storage/__init__.py +4 -0
  82. aiomax2-0.1.0a2/src/aiomax2/fsm/storage/base.py +41 -0
  83. aiomax2-0.1.0a2/src/aiomax2/fsm/storage/memory.py +60 -0
  84. aiomax2-0.1.0a2/src/aiomax2/fsm/strategy.py +7 -0
  85. aiomax2-0.1.0a2/src/aiomax2/py.typed +1 -0
  86. aiomax2-0.1.0a2/src/aiomax2/types/__init__.py +219 -0
  87. aiomax2-0.1.0a2/src/aiomax2/types/api.py +100 -0
  88. aiomax2-0.1.0a2/src/aiomax2/types/attachments.py +305 -0
  89. aiomax2-0.1.0a2/src/aiomax2/types/base.py +37 -0
  90. aiomax2-0.1.0a2/src/aiomax2/types/callback.py +59 -0
  91. aiomax2-0.1.0a2/src/aiomax2/types/chat.py +33 -0
  92. aiomax2-0.1.0a2/src/aiomax2/types/message.py +207 -0
  93. aiomax2-0.1.0a2/src/aiomax2/types/update.py +259 -0
  94. aiomax2-0.1.0a2/src/aiomax2/types/user.py +50 -0
  95. aiomax2-0.1.0a2/src/aiomax2/utils/__init__.py +3 -0
  96. aiomax2-0.1.0a2/src/aiomax2/utils/keyboard.py +203 -0
  97. aiomax2-0.1.0a2/src/aiomax2/warnings.py +2 -0
  98. aiomax2-0.1.0a2/src/aiomax2/webhook/__init__.py +3 -0
  99. aiomax2-0.1.0a2/src/aiomax2/webhook/fastapi.py +40 -0
  100. aiomax2-0.1.0a2/src/aiomax2/webhook/handler.py +60 -0
  101. aiomax2-0.1.0a2/tests/conftest.py +54 -0
  102. aiomax2-0.1.0a2/tests/test_bot.py +581 -0
  103. aiomax2-0.1.0a2/tests/test_dispatcher.py +142 -0
  104. aiomax2-0.1.0a2/tests/test_filters.py +50 -0
  105. aiomax2-0.1.0a2/tests/test_fsm.py +49 -0
  106. aiomax2-0.1.0a2/tests/test_http.py +474 -0
  107. aiomax2-0.1.0a2/tests/test_keyboard.py +182 -0
  108. aiomax2-0.1.0a2/tests/test_rate_limiter.py +118 -0
  109. aiomax2-0.1.0a2/tests/test_types.py +132 -0
  110. aiomax2-0.1.0a2/tests/test_webhook.py +76 -0
@@ -0,0 +1,41 @@
1
+ name: Сообщить об ошибке
2
+ description: Воспроизводимая ошибка в aiomax2
3
+ title: "[Bug]: "
4
+ labels: ["bug"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: Не публикуйте MAX token, webhook secret или персональные данные.
9
+ - type: input
10
+ id: version
11
+ attributes:
12
+ label: Версия aiomax2
13
+ placeholder: 0.1.0a1
14
+ validations:
15
+ required: true
16
+ - type: input
17
+ id: python
18
+ attributes:
19
+ label: Версия Python
20
+ placeholder: 3.12.7
21
+ validations:
22
+ required: true
23
+ - type: textarea
24
+ id: steps
25
+ attributes:
26
+ label: Шаги воспроизведения
27
+ validations:
28
+ required: true
29
+ - type: textarea
30
+ id: expected
31
+ attributes:
32
+ label: Ожидаемое поведение
33
+ validations:
34
+ required: true
35
+ - type: textarea
36
+ id: actual
37
+ attributes:
38
+ label: Фактическое поведение и traceback
39
+ validations:
40
+ required: true
41
+
@@ -0,0 +1,24 @@
1
+ name: Предложить улучшение
2
+ description: Новый API, DX или документационное улучшение
3
+ title: "[Feature]: "
4
+ labels: ["enhancement"]
5
+ body:
6
+ - type: textarea
7
+ id: use_case
8
+ attributes:
9
+ label: Сценарий использования
10
+ description: Какую задачу разработчика решает предложение?
11
+ validations:
12
+ required: true
13
+ - type: textarea
14
+ id: max_source
15
+ attributes:
16
+ label: Источник MAX API
17
+ description: Ссылка на официальную документацию или OpenAPI, если применимо.
18
+ - type: textarea
19
+ id: proposal
20
+ attributes:
21
+ label: Предлагаемый API
22
+ validations:
23
+ required: true
24
+
@@ -0,0 +1,17 @@
1
+ ## Что изменено
2
+
3
+ Опишите изменение и его пользовательский эффект.
4
+
5
+ ## Источник MAX API
6
+
7
+ Добавьте ссылку на официальную документацию/OpenAPI или укажите, что изменение
8
+ не затрагивает API MAX.
9
+
10
+ ## Проверка
11
+
12
+ - [ ] `python -m ruff format --check .`
13
+ - [ ] `python -m ruff check .`
14
+ - [ ] `python -m mypy src/aiomax2`
15
+ - [ ] `python -m pytest`
16
+ - [ ] Документация и примеры соответствуют реальному public API
17
+ - [ ] В изменениях нет tokens, secrets и пользовательских данных
@@ -0,0 +1,24 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ matrix:
12
+ python-version: ["3.12", "3.13"]
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: ${{ matrix.python-version }}
18
+ cache: pip
19
+ - run: python -m pip install -e ".[dev]"
20
+ - run: python -m ruff format --check .
21
+ - run: python -m ruff check .
22
+ - run: python -m mypy src/aiomax2
23
+ - run: python -m pytest
24
+
@@ -0,0 +1,50 @@
1
+ name: Documentation
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths:
7
+ - "docs/**"
8
+ - "src/**"
9
+ - "mkdocs.yml"
10
+ - "pyproject.toml"
11
+ - ".github/workflows/docs.yml"
12
+ workflow_dispatch:
13
+
14
+ permissions:
15
+ contents: read
16
+ pages: write
17
+ id-token: write
18
+
19
+ concurrency:
20
+ group: pages
21
+ cancel-in-progress: true
22
+
23
+ jobs:
24
+ build:
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - uses: actions/setup-python@v5
29
+ with:
30
+ python-version: "3.12"
31
+ cache: pip
32
+ - name: Configure GitHub Pages
33
+ uses: actions/configure-pages@v5
34
+ - run: python -m pip install -e ".[docs]"
35
+ - run: python -m mkdocs build --strict
36
+ - name: Upload GitHub Pages artifact
37
+ uses: actions/upload-pages-artifact@v4
38
+ with:
39
+ path: site
40
+
41
+ deploy:
42
+ environment:
43
+ name: github-pages
44
+ url: ${{ steps.deployment.outputs.page_url }}
45
+ runs-on: ubuntu-latest
46
+ needs: build
47
+ steps:
48
+ - name: Deploy to GitHub Pages
49
+ id: deployment
50
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,61 @@
1
+ # Python bytecode and caches
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Build and packaging artifacts
7
+ build/
8
+ dist/
9
+ .eggs/
10
+ *.egg
11
+ *.egg-info/
12
+
13
+ # Virtual environments
14
+ .venv/
15
+ venv/
16
+ env/
17
+ ENV/
18
+
19
+ # Tests and coverage artifacts (the tests/ source directory is tracked)
20
+ .pytest_cache/
21
+ .coverage
22
+ .coverage.*
23
+ coverage.xml
24
+ htmlcov/
25
+ .tox/
26
+ .nox/
27
+
28
+ # Linters and type checkers
29
+ .mypy_cache/
30
+ .ruff_cache/
31
+ .pytype/
32
+ .pyre/
33
+
34
+ # Documentation builds
35
+ site/
36
+ .mkdocs_cache/
37
+
38
+ # Local configuration and secrets
39
+ .env
40
+ .env.*
41
+ !.env.example
42
+ *.key
43
+ *.p12
44
+ *.pfx
45
+
46
+ # Logs and temporary files
47
+ *.log
48
+ *.tmp
49
+ *.swp
50
+ *~
51
+
52
+ # IDEs and editors
53
+ .idea/
54
+ .vscode/
55
+ .fleet/
56
+ *.code-workspace
57
+
58
+ # Operating system files
59
+ .DS_Store
60
+ Thumbs.db
61
+ Desktop.ini
@@ -0,0 +1,65 @@
1
+ # Changelog
2
+
3
+ Все заметные изменения проекта документируются в этом файле. Формат основан
4
+ на [Keep a Changelog](https://keepachangelog.com/ru/1.1.0/), версии следуют
5
+ Semantic Versioning с pre-release суффиксами.
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0a2] - 2026-10-06
10
+
11
+ ### Изменено
12
+
13
+ - target rate limiter распространён на отправку, редактирование и удаление
14
+ сообщений, а также callback answers;
15
+ - shortcuts передают `chat_id`/`user_id` в low-level методы;
16
+ - token гарантированно добавляется к API requests с custom `ClientSession`;
17
+ - внешние upload requests изолированы от headers API session;
18
+ - проверяющий `SSLContext` принудительно применяется к каждому API request,
19
+ включая requests через custom session с небезопасным connector;
20
+ - custom `SSLContext` без проверки hostname или сертификата отклоняется;
21
+ - единый per-target limiter документирован как консервативная клиентская
22
+ политика, а process-local и multi-worker ограничения описаны явно;
23
+ - FastAPI и Uvicorn включены в стандартную установку, optional extra удалён;
24
+ - Webhook configuration упрощена до public base URL и локального route path;
25
+ - lifespan annotations обновлены с `AsyncIterator` на `AsyncGenerator`;
26
+ - пользовательская документация и примеры переведены на русский язык;
27
+ - добавлен удобный `reply_markup` поверх настоящего MAX keyboard attachment;
28
+ - HTML и MAX Markdown оформлены как документированный public API через
29
+ `TextFormat` без неподдерживаемого `MARKDOWN_V2`;
30
+ - `attachment.not.ready` обрабатывается отдельным bounded retry только при
31
+ отправке/изменении сообщения с attachment;
32
+ - исправлена ASCII-валидация `open_app` payload;
33
+ - documentation notification-only callback уточнена с учётом необходимости
34
+ live verification;
35
+ - каждый attachment retry теперь повторно учитывается per-target limiter;
36
+ - уточнено, что `reply_markup=None` не удаляет клавиатуру, а `attachments=[]`
37
+ удаляет все вложения;
38
+ - добавлен явный небезопасный режим `verify_ssl=False` с
39
+ `InsecureTLSWarning`, безопасный default сохранён;
40
+ - расширено руководство по сертификатам Минцифры и добавлен официальный
41
+ источник: https://www.gosuslugi.ru/landing/tls.
42
+
43
+ ### Добавлено
44
+
45
+ - конкурентные и cancellation tests rate limiter;
46
+ - tests для нескольких targets, 30 concurrent requests и повторных `429`;
47
+ - transport tests для TLS override, custom sessions, upload authorization и
48
+ исчерпания повторов после `429`;
49
+ - полное руководство по Webhook, Long Polling, FSM, middleware и rate limits;
50
+ - пример выбора Polling или Webhook через `MAX_MODE` для одной кодовой базы;
51
+ - MkDocs configuration, официальный GitHub Pages workflow и community files;
52
+ - `InlineKeyboardBuilder` для всех семи актуальных MAX button types;
53
+ - typed `answer_callback_result()` для сохранения diagnostic message при
54
+ `success=false` без изменения совместимого `answer_callback() -> bool`;
55
+ - keyboard/formatting examples, TLS troubleshooting и расширенные tests для
56
+ callback serialization, keyboard limits и attachment readiness.
57
+
58
+ ## [0.1.0a1] - 2026-10-05
59
+
60
+ ### Добавлено
61
+
62
+ - первый alpha-релиз `Bot`, `Dispatcher`, `Router`, filters, FSM и Webhook;
63
+ - типизированные модели MAX OpenAPI `0.0.33`;
64
+ - aiohttp transport, TLS validation, retries и базовые rate limits;
65
+ - unit и mock-server integration tests.
@@ -0,0 +1,40 @@
1
+ # Участие в разработке
2
+
3
+ Спасибо за интерес к aiomax2.
4
+
5
+ `aiomax2` следует актуальной документации и OpenAPI-схеме MAX.
6
+ Архитектура и developer experience могут использовать знакомые подходы из
7
+ aiogram 3.x, но модели, методы, события и ограничения MAX всегда остаются
8
+ источником истины.
9
+
10
+ ## Локальная настройка
11
+
12
+ ```bash
13
+ git clone https://github.com/CandyCrimsie/aiomax2.git
14
+ cd aiomax2
15
+
16
+ python -m venv .venv
17
+ python -m pip install -e ".[dev]"
18
+ ```
19
+
20
+ ## Перед pull request
21
+
22
+ ```bash
23
+ python -m ruff format --check .
24
+ python -m ruff check .
25
+ python -m mypy src/aiomax2
26
+ python -m pytest
27
+ python -m mkdocs build --strict
28
+ ```
29
+
30
+ Для изменения endpoint, модели или события приложите ссылку на официальную
31
+ документацию MAX или строку актуальной OpenAPI-схемы.
32
+
33
+ Исторические реализации и сторонние библиотеки можно использовать только как
34
+ источник идей, но не как источник истины для поведения MAX API.
35
+
36
+ Новый публичный API должен иметь typing, тесты и русскоязычный пример или
37
+ документацию.
38
+
39
+ Не добавляйте секреты, реальные токены и приватные webhook URLs в fixtures,
40
+ examples или документацию.
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026-present CandyCrimsie and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+