Архитектурное разделение для webhook-режима#68
Merged
love-apples merged 4 commits intolove-apples:mainfrom Mar 25, 2026
Merged
Conversation
…а документация по установке и использованию.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
PR переносит webhook-режим на отдельные интеграционные модули, чтобы maxapi не зависел от конкретного веб-сервера и не требовал дополнительных пакетов по умолчанию.
Changes:
- Вынесена общая логика webhook-диспетчеризации в
BaseMaxWebhookи добавлены интеграции дляaiohttp,FastAPI,Litestar. Dispatcher.handle_webhook()переведён наaiohttp-сервер по умолчанию, добавленstartup()для интеграций;init_serve()помечен deprecated.- Обновлены документация/README и добавлен пакет тестов для нового webhook-слоя.
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_webhook_post.py | Удалён старый тест под FastAPI-декоратор webhook_post. |
| tests/test_webhook/test_webhook_post.py | Новые тесты FastAPI-интеграции (setup/create_app/secret/run). |
| tests/test_webhook/test_litestar_webhook.py | Новые тесты Litestar-интеграции (handlers/secret/run). |
| tests/test_webhook/test_handler_crash.py | Тесты поведения при падении dp.handle (ожидаемый 500). |
| tests/test_webhook/test_handle_webhook_route.py | Тесты маршрута вебхука переведены на FastAPIMaxWebhook. |
| tests/test_webhook/test_dispatcher_startup_webhook.py | Тест для Dispatcher.startup(). |
| tests/test_webhook/test_dispatcher_handle_webhook.py | Тесты делегирования Dispatcher.handle_webhook() в aiohttp webhook runner. |
| tests/test_webhook/test_aiohttp_webhook.py | Новые тесты aiohttp-интеграции (routes/secret/run). |
| tests/test_webhook/init.py | Инициализация пакета webhook-тестов. |
| pyproject.toml | Переразметка optional extras: fastapi, litestar; добавлены в dev-group. |
| maxapi/webhook/base.py | Общая базовая логика webhook: startup + dispatch + дефолты. |
| maxapi/webhook/aiohttp.py | Реализация webhook сервера на aiohttp (setup/create_app/run). |
| maxapi/webhook/fastapi.py | Интеграция с FastAPI (lifespan/setup/create_app/run, secret dependency). |
| maxapi/webhook/litestar.py | Интеграция с Litestar (handler/guards/create_app/run). |
| maxapi/webhook/init.py | Экспорт базовых сущностей webhook-подсистемы. |
| maxapi/dispatcher.py | Удалена FastAPI/uvicorn-связка, добавлены startup(), новый handle_webhook() на aiohttp, init_serve() deprecated. |
| docs/index.md | Обновлены инструкции установки/использования webhook и extras. |
| docs/guides/webhook_vs_polling.md | Обновлён пример host; частично обновлено описание параметров. |
| docs/guides/installation.md | Обновлён раздел установки: aiohttp “из коробки”, extras для ASGI. |
| docs/examples.md | Переписан webhook low-level пример под FastAPIMaxWebhook. |
| README.md | Обновлён раздел webhook (aiohttp по умолчанию + extras). |
Comments suppressed due to low confidence (1)
README.md:139
- В README нарушена разметка блока кода: после blockquote добавлен повторный
if __name__ == '__main__': ...и лишняя закрывающая тройная кавычка. Сейчас файл содержит дублирующийся запуск и незакрытый/лишний fenced code block, из-за чего Markdown будет рендериться некорректно. Уберите дубликат и поправьте границы ```.
> **Хотите использовать FastAPI или Litestar вместо aiohttp?**
> Установите нужную опциональную зависимость:
> ```bash
> pip install maxapi[fastapi] # FastAPI + uvicorn
> pip install maxapi[litestar] # Litestar + uvicorn
> ```
if __name__ == '__main__':
asyncio.run(main())
</details>
---
💡 <a href="/love-apples/maxapi/new/main?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Разрезал архитектурный узел, где maxapi нужен был webserver для работа, а webserver'у нужен был maxapi.
closes #67
closes #66