aury-boot 0.0.4__tar.gz → 0.0.5__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.
- {aury_boot-0.0.4 → aury_boot-0.0.5}/PKG-INFO +19 -2
- {aury_boot-0.0.4 → aury_boot-0.0.5}/README.md +18 -1
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/__init__.py +2 -2
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/_version.py +2 -2
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/__init__.py +45 -36
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/app/__init__.py +12 -8
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/app/base.py +12 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/app/components.py +137 -44
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/app/middlewares.py +2 -0
- aury_boot-0.0.5/aury/boot/application/app/startup.py +249 -0
- aury_boot-0.0.5/aury/boot/application/config/__init__.py +79 -0
- aury_boot-0.0.5/aury/boot/application/config/multi_instance.py +200 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/config/settings.py +341 -12
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/constants/components.py +6 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/errors/handlers.py +17 -3
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/middleware/logging.py +8 -120
- aury_boot-0.0.5/aury/boot/commands/__init__.py +50 -0
- aury_boot-0.0.5/aury/boot/commands/app.py +235 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/docs.py +104 -17
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/init.py +27 -8
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/server/app.py +2 -3
- aury_boot-0.0.5/aury/boot/commands/templates/project/AGENTS.md.tpl +217 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/templates/project/README.md.tpl +2 -2
- aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/00-overview.md.tpl +59 -0
- aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/01-model.md.tpl +183 -0
- aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/02-repository.md.tpl +206 -0
- aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/03-service.md.tpl +398 -0
- aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/04-schema.md.tpl +95 -0
- aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/05-api.md.tpl +116 -0
- aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/06-exception.md.tpl +118 -0
- aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/07-cache.md.tpl +122 -0
- aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/08-scheduler.md.tpl +32 -0
- aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/09-tasks.md.tpl +38 -0
- aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/10-storage.md.tpl +115 -0
- aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/11-logging.md.tpl +92 -0
- aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/12-admin.md.tpl +56 -0
- aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/13-channel.md.tpl +92 -0
- aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/14-mq.md.tpl +102 -0
- aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/15-events.md.tpl +147 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/templates/project/config.py.tpl +1 -1
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/templates/project/env.example.tpl +73 -5
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/templates/project/modules/tasks.py.tpl +1 -1
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/contrib/admin_console/auth.py +2 -3
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/contrib/admin_console/install.py +1 -1
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/domain/models/mixins.py +48 -1
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/domain/pagination/__init__.py +94 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/domain/repository/interface.py +1 -1
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/domain/transaction/__init__.py +8 -9
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/__init__.py +86 -29
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/cache/backends.py +102 -18
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/cache/base.py +12 -0
- aury_boot-0.0.5/aury/boot/infrastructure/cache/manager.py +336 -0
- aury_boot-0.0.5/aury/boot/infrastructure/channel/__init__.py +24 -0
- aury_boot-0.0.5/aury/boot/infrastructure/channel/backends/__init__.py +9 -0
- aury_boot-0.0.5/aury/boot/infrastructure/channel/backends/memory.py +83 -0
- aury_boot-0.0.5/aury/boot/infrastructure/channel/backends/redis.py +88 -0
- aury_boot-0.0.5/aury/boot/infrastructure/channel/base.py +92 -0
- aury_boot-0.0.5/aury/boot/infrastructure/channel/manager.py +203 -0
- aury_boot-0.0.5/aury/boot/infrastructure/clients/__init__.py +22 -0
- aury_boot-0.0.5/aury/boot/infrastructure/clients/rabbitmq/__init__.py +9 -0
- aury_boot-0.0.5/aury/boot/infrastructure/clients/rabbitmq/config.py +46 -0
- aury_boot-0.0.5/aury/boot/infrastructure/clients/rabbitmq/manager.py +288 -0
- aury_boot-0.0.5/aury/boot/infrastructure/clients/redis/__init__.py +28 -0
- aury_boot-0.0.5/aury/boot/infrastructure/clients/redis/config.py +51 -0
- aury_boot-0.0.5/aury/boot/infrastructure/clients/redis/manager.py +264 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/database/config.py +1 -2
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/database/manager.py +16 -38
- aury_boot-0.0.5/aury/boot/infrastructure/events/__init__.py +30 -0
- aury_boot-0.0.5/aury/boot/infrastructure/events/backends/__init__.py +11 -0
- aury_boot-0.0.5/aury/boot/infrastructure/events/backends/memory.py +86 -0
- aury_boot-0.0.5/aury/boot/infrastructure/events/backends/rabbitmq.py +193 -0
- aury_boot-0.0.5/aury/boot/infrastructure/events/backends/redis.py +162 -0
- aury_boot-0.0.5/aury/boot/infrastructure/events/base.py +127 -0
- aury_boot-0.0.5/aury/boot/infrastructure/events/manager.py +224 -0
- aury_boot-0.0.5/aury/boot/infrastructure/mq/__init__.py +24 -0
- aury_boot-0.0.5/aury/boot/infrastructure/mq/backends/__init__.py +9 -0
- aury_boot-0.0.5/aury/boot/infrastructure/mq/backends/rabbitmq.py +179 -0
- aury_boot-0.0.5/aury/boot/infrastructure/mq/backends/redis.py +167 -0
- aury_boot-0.0.5/aury/boot/infrastructure/mq/base.py +143 -0
- aury_boot-0.0.5/aury/boot/infrastructure/mq/manager.py +239 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/scheduler/manager.py +7 -3
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/storage/base.py +17 -5
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/storage/factory.py +0 -1
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/tasks/__init__.py +2 -2
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/tasks/manager.py +47 -29
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/testing/base.py +2 -2
- {aury_boot-0.0.4 → aury_boot-0.0.5}/pyproject.toml +7 -0
- aury_boot-0.0.4/aury/boot/application/config/__init__.py +0 -44
- aury_boot-0.0.4/aury/boot/commands/__init__.py +0 -30
- aury_boot-0.0.4/aury/boot/commands/app.py +0 -105
- aury_boot-0.0.4/aury/boot/commands/templates/project/DEVELOPMENT.md.tpl +0 -1397
- aury_boot-0.0.4/aury/boot/infrastructure/cache/manager.py +0 -274
- aury_boot-0.0.4/aury/boot/infrastructure/events/__init__.py +0 -33
- aury_boot-0.0.4/aury/boot/infrastructure/events/bus.py +0 -362
- aury_boot-0.0.4/aury/boot/infrastructure/events/config.py +0 -52
- aury_boot-0.0.4/aury/boot/infrastructure/events/consumer.py +0 -134
- aury_boot-0.0.4/aury/boot/infrastructure/events/models.py +0 -63
- {aury_boot-0.0.4 → aury_boot-0.0.5}/.gitignore +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/constants/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/constants/scheduler.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/constants/service.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/errors/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/errors/chain.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/errors/codes.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/errors/exceptions.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/errors/response.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/interfaces/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/interfaces/egress.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/interfaces/ingress.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/middleware/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/migrations/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/migrations/manager.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/migrations/setup.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/rpc/__init__.py +2 -2
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/rpc/base.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/rpc/client.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/rpc/discovery.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/scheduler/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/scheduler/runner.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/application/server/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/add.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/config.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/docker.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/generate.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/migrate/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/migrate/app.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/migrate/commands.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/scheduler.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/server/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/templates/generate/api.py.tpl +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/templates/generate/model.py.tpl +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/templates/generate/repository.py.tpl +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/templates/generate/schema.py.tpl +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/templates/generate/service.py.tpl +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/templates/project/admin_console_init.py.tpl +0 -0
- aury_boot-0.0.4/aury/boot/commands/templates/project/CLI.md.tpl → aury_boot-0.0.5/aury/boot/commands/templates/project/aury_docs/99-cli.md.tpl +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/templates/project/conftest.py.tpl +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/templates/project/gitignore.tpl +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/templates/project/main.py.tpl +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/templates/project/modules/api.py.tpl +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/templates/project/modules/exceptions.py.tpl +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/templates/project/modules/schedules.py.tpl +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/commands/worker.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/common/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/common/exceptions/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/common/i18n/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/common/i18n/translator.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/common/logging/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/contrib/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/contrib/admin_console/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/contrib/admin_console/discovery.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/contrib/admin_console/utils.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/domain/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/domain/exceptions/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/domain/models/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/domain/models/base.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/domain/models/models.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/domain/repository/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/domain/repository/impl.py +1 -1
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/domain/repository/interceptors.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/domain/repository/query_builder.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/domain/service/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/domain/service/base.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/cache/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/cache/exceptions.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/cache/factory.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/database/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/database/exceptions.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/database/query_tools/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/database/strategies/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/di/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/di/container.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/events/middleware.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/monitoring/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/scheduler/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/scheduler/exceptions.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/storage/__init__.py +9 -9
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/storage/exceptions.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/tasks/config.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/tasks/constants.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/infrastructure/tasks/exceptions.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/testing/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/testing/client.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/testing/factory.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/toolkit/__init__.py +0 -0
- {aury_boot-0.0.4 → aury_boot-0.0.5}/aury/boot/toolkit/http/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aury-boot
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.5
|
|
4
4
|
Summary: Aury Boot - 基于 FastAPI 生态的企业级 API 开发框架
|
|
5
5
|
Requires-Python: >=3.13
|
|
6
6
|
Requires-Dist: alembic>=1.17.2
|
|
@@ -72,7 +72,24 @@ Description-Content-Type: text/markdown
|
|
|
72
72
|
|
|
73
73
|
# Aury Boot
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
基于 FastAPI 生态的企业级 API 开发框架,提供所有微服务共用的基础设施组件。
|
|
76
|
+
|
|
77
|
+
## 快速开始
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# 1. 创建项目目录并初始化
|
|
81
|
+
mkdir my-service && cd my-service
|
|
82
|
+
uv init . --name my_service --no-package --python 3.13
|
|
83
|
+
|
|
84
|
+
# 2. 添加依赖
|
|
85
|
+
uv add "aury-boot[recommended,admin]" # admin 可选,提供 SQLAdmin 管理后台
|
|
86
|
+
|
|
87
|
+
# 3. 初始化项目结构
|
|
88
|
+
aury init
|
|
89
|
+
|
|
90
|
+
# 4. 启动开发服务器
|
|
91
|
+
aury server dev
|
|
92
|
+
```
|
|
76
93
|
|
|
77
94
|
## 功能模块
|
|
78
95
|
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
# Aury Boot
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
基于 FastAPI 生态的企业级 API 开发框架,提供所有微服务共用的基础设施组件。
|
|
4
|
+
|
|
5
|
+
## 快速开始
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 1. 创建项目目录并初始化
|
|
9
|
+
mkdir my-service && cd my-service
|
|
10
|
+
uv init . --name my_service --no-package --python 3.13
|
|
11
|
+
|
|
12
|
+
# 2. 添加依赖
|
|
13
|
+
uv add "aury-boot[recommended,admin]" # admin 可选,提供 SQLAdmin 管理后台
|
|
14
|
+
|
|
15
|
+
# 3. 初始化项目结构
|
|
16
|
+
aury init
|
|
17
|
+
|
|
18
|
+
# 4. 启动开发服务器
|
|
19
|
+
aury server dev
|
|
20
|
+
```
|
|
4
21
|
|
|
5
22
|
## 功能模块
|
|
6
23
|
|
|
@@ -52,7 +52,7 @@ def __getattr__(name: str):
|
|
|
52
52
|
|
|
53
53
|
def __dir__():
|
|
54
54
|
"""返回可用属性列表。"""
|
|
55
|
-
return list(_SUBMODULES)
|
|
55
|
+
return [*list(_SUBMODULES), "__version__"]
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
__all__ = [
|
|
@@ -61,6 +61,6 @@ __all__ = [
|
|
|
61
61
|
"common",
|
|
62
62
|
"domain",
|
|
63
63
|
"infrastructure",
|
|
64
|
-
"toolkit",
|
|
65
64
|
"testing",
|
|
65
|
+
"toolkit",
|
|
66
66
|
]
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.0.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 0,
|
|
31
|
+
__version__ = version = '0.0.5'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 0, 5)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -17,10 +17,15 @@ from aury.boot.domain.transaction import (
|
|
|
17
17
|
from aury.boot.infrastructure.di import Container, Lifetime, Scope, ServiceDescriptor
|
|
18
18
|
from aury.boot.infrastructure.events import (
|
|
19
19
|
Event,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
EventBackend,
|
|
21
|
+
EventBusManager,
|
|
22
|
+
EventHandler,
|
|
23
|
+
EventType,
|
|
24
|
+
IEventBus,
|
|
25
|
+
# 后端实现
|
|
26
|
+
MemoryEventBus,
|
|
27
|
+
RabbitMQEventBus,
|
|
28
|
+
RedisEventBus,
|
|
24
29
|
)
|
|
25
30
|
|
|
26
31
|
from . import interfaces, rpc
|
|
@@ -62,59 +67,63 @@ from .scheduler import run_scheduler, run_scheduler_sync
|
|
|
62
67
|
from .server import ApplicationServer, run_app
|
|
63
68
|
|
|
64
69
|
__all__ = [
|
|
70
|
+
# 服务器集成
|
|
71
|
+
"ApplicationServer",
|
|
65
72
|
# 配置
|
|
66
73
|
"BaseConfig",
|
|
74
|
+
# 中间件
|
|
75
|
+
"CORSMiddleware",
|
|
67
76
|
"CORSSettings",
|
|
77
|
+
# 组件
|
|
78
|
+
"CacheComponent",
|
|
68
79
|
"CacheSettings",
|
|
69
|
-
|
|
70
|
-
"
|
|
80
|
+
# 基类
|
|
81
|
+
"Component",
|
|
71
82
|
# 常量
|
|
72
83
|
"ComponentName",
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
"
|
|
84
|
+
# 依赖注入容器
|
|
85
|
+
"Container",
|
|
86
|
+
"DatabaseComponent",
|
|
87
|
+
# 事件系统
|
|
88
|
+
"Event",
|
|
89
|
+
"EventBackend",
|
|
90
|
+
"EventBusManager",
|
|
91
|
+
"EventHandler",
|
|
92
|
+
"EventType",
|
|
76
93
|
# 应用框架
|
|
77
94
|
"FoundationApp",
|
|
78
|
-
|
|
79
|
-
"
|
|
95
|
+
"IEventBus",
|
|
96
|
+
"Lifetime",
|
|
97
|
+
"LogSettings",
|
|
98
|
+
"MemoryEventBus",
|
|
80
99
|
"Middleware",
|
|
81
|
-
|
|
82
|
-
"CORSMiddleware",
|
|
83
|
-
"RequestLoggingMiddleware",
|
|
84
|
-
# 组件
|
|
85
|
-
"CacheComponent",
|
|
86
|
-
"DatabaseComponent",
|
|
100
|
+
"MiddlewareName",
|
|
87
101
|
"MigrationComponent",
|
|
102
|
+
# 迁移
|
|
103
|
+
"MigrationManager",
|
|
104
|
+
"RabbitMQEventBus",
|
|
105
|
+
"RedisEventBus",
|
|
106
|
+
"RequestLoggingMiddleware",
|
|
88
107
|
"SchedulerComponent",
|
|
89
|
-
"
|
|
90
|
-
# 依赖注入容器
|
|
91
|
-
"Container",
|
|
92
|
-
"Lifetime",
|
|
108
|
+
"SchedulerMode",
|
|
93
109
|
"Scope",
|
|
110
|
+
"ServerSettings",
|
|
94
111
|
"ServiceDescriptor",
|
|
95
|
-
|
|
96
|
-
"
|
|
97
|
-
"EventBus",
|
|
98
|
-
"EventConsumer",
|
|
99
|
-
"EventLoggingMiddleware",
|
|
100
|
-
"EventMiddleware",
|
|
101
|
-
# 迁移
|
|
102
|
-
"MigrationManager",
|
|
103
|
-
# HTTP 中间件装饰器
|
|
104
|
-
"log_request",
|
|
112
|
+
"ServiceType",
|
|
113
|
+
"TaskComponent",
|
|
105
114
|
# 事务管理
|
|
106
115
|
"TransactionManager",
|
|
107
116
|
"TransactionRequiredError",
|
|
108
117
|
"ensure_transaction",
|
|
109
|
-
|
|
110
|
-
"
|
|
118
|
+
# HTTP 中间件装饰器
|
|
119
|
+
"log_request",
|
|
111
120
|
# RPC通信
|
|
112
121
|
"rpc",
|
|
122
|
+
"run_app",
|
|
113
123
|
# 调度器启动器
|
|
114
124
|
"run_scheduler",
|
|
115
125
|
"run_scheduler_sync",
|
|
116
|
-
|
|
117
|
-
"
|
|
118
|
-
"run_app",
|
|
126
|
+
"transactional",
|
|
127
|
+
"transactional_context",
|
|
119
128
|
]
|
|
120
129
|
|
|
@@ -8,6 +8,8 @@ from .components import (
|
|
|
8
8
|
AdminConsoleComponent,
|
|
9
9
|
CacheComponent,
|
|
10
10
|
DatabaseComponent,
|
|
11
|
+
EventBusComponent,
|
|
12
|
+
MessageQueueComponent,
|
|
11
13
|
MigrationComponent,
|
|
12
14
|
SchedulerComponent,
|
|
13
15
|
TaskComponent,
|
|
@@ -18,19 +20,21 @@ from .middlewares import (
|
|
|
18
20
|
)
|
|
19
21
|
|
|
20
22
|
__all__ = [
|
|
21
|
-
# 应用框架
|
|
22
|
-
"FoundationApp",
|
|
23
|
-
# 基类
|
|
24
|
-
"Component",
|
|
25
|
-
"Middleware",
|
|
26
|
-
# 中间件
|
|
27
|
-
"CORSMiddleware",
|
|
28
|
-
"RequestLoggingMiddleware",
|
|
29
23
|
# 组件
|
|
30
24
|
"AdminConsoleComponent",
|
|
25
|
+
# 中间件
|
|
26
|
+
"CORSMiddleware",
|
|
31
27
|
"CacheComponent",
|
|
28
|
+
# 基类
|
|
29
|
+
"Component",
|
|
32
30
|
"DatabaseComponent",
|
|
31
|
+
"EventBusComponent",
|
|
32
|
+
# 应用框架
|
|
33
|
+
"FoundationApp",
|
|
34
|
+
"MessageQueueComponent",
|
|
35
|
+
"Middleware",
|
|
33
36
|
"MigrationComponent",
|
|
37
|
+
"RequestLoggingMiddleware",
|
|
34
38
|
"SchedulerComponent",
|
|
35
39
|
"TaskComponent",
|
|
36
40
|
]
|
|
@@ -349,6 +349,18 @@ class FoundationApp(FastAPI):
|
|
|
349
349
|
raise
|
|
350
350
|
|
|
351
351
|
logger.info("应用启动完成")
|
|
352
|
+
|
|
353
|
+
# 打印启动横幅和组件状态
|
|
354
|
+
from aury.boot.application.app.startup import (
|
|
355
|
+
collect_component_status,
|
|
356
|
+
print_startup_banner,
|
|
357
|
+
)
|
|
358
|
+
components = collect_component_status()
|
|
359
|
+
print_startup_banner(
|
|
360
|
+
app_name=self.title,
|
|
361
|
+
version=self.version,
|
|
362
|
+
components=components,
|
|
363
|
+
)
|
|
352
364
|
|
|
353
365
|
except Exception as e:
|
|
354
366
|
logger.error(f"应用启动异常: {e}")
|
|
@@ -16,6 +16,8 @@ from aury.boot.application.migrations import MigrationManager
|
|
|
16
16
|
from aury.boot.common.logging import logger
|
|
17
17
|
from aury.boot.infrastructure.cache import CacheManager
|
|
18
18
|
from aury.boot.infrastructure.database import DatabaseManager
|
|
19
|
+
from aury.boot.infrastructure.events import EventBusManager
|
|
20
|
+
from aury.boot.infrastructure.mq import MQManager
|
|
19
21
|
from aury.boot.infrastructure.scheduler import SchedulerManager
|
|
20
22
|
from aury.boot.infrastructure.storage import StorageManager
|
|
21
23
|
from aury.boot.infrastructure.tasks import TaskManager
|
|
@@ -74,12 +76,12 @@ class CacheComponent(Component):
|
|
|
74
76
|
"""初始化缓存。"""
|
|
75
77
|
try:
|
|
76
78
|
cache_manager = CacheManager.get_instance()
|
|
77
|
-
if not cache_manager.
|
|
78
|
-
await cache_manager.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
if not cache_manager.is_initialized:
|
|
80
|
+
await cache_manager.initialize(
|
|
81
|
+
backend=config.cache.cache_type,
|
|
82
|
+
url=config.cache.url,
|
|
83
|
+
max_size=config.cache.max_size,
|
|
84
|
+
)
|
|
83
85
|
except Exception as e:
|
|
84
86
|
logger.warning(f"缓存初始化失败(非关键): {e}")
|
|
85
87
|
|
|
@@ -87,7 +89,7 @@ class CacheComponent(Component):
|
|
|
87
89
|
"""关闭缓存。"""
|
|
88
90
|
try:
|
|
89
91
|
cache_manager = CacheManager.get_instance()
|
|
90
|
-
if cache_manager.
|
|
92
|
+
if cache_manager.is_initialized:
|
|
91
93
|
await cache_manager.cleanup()
|
|
92
94
|
except Exception as e:
|
|
93
95
|
logger.warning(f"缓存关闭失败: {e}")
|
|
@@ -95,53 +97,53 @@ class CacheComponent(Component):
|
|
|
95
97
|
|
|
96
98
|
class StorageComponent(Component):
|
|
97
99
|
"""对象存储组件。
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
- 建议由应用的 `StorageSettings` 读取环境变量并构造 SDK 的 StorageConfig
|
|
102
|
-
"""
|
|
100
|
+
|
|
101
|
+
支持多实例配置,通过环境变量 STORAGE_{INSTANCE}_{FIELD} 配置。
|
|
102
|
+
"""
|
|
103
103
|
|
|
104
104
|
name = ComponentName.STORAGE
|
|
105
105
|
enabled = True
|
|
106
106
|
depends_on: ClassVar[list[str]] = []
|
|
107
107
|
|
|
108
108
|
def can_enable(self, config: BaseConfig) -> bool:
|
|
109
|
-
|
|
110
|
-
return self.enabled and bool(
|
|
109
|
+
"""当配置了 Storage 实例时启用。"""
|
|
110
|
+
return self.enabled and bool(config.get_storages())
|
|
111
111
|
|
|
112
112
|
async def setup(self, app: FoundationApp, config: BaseConfig) -> None:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
logger.warning(f"存储初始化失败(非关键): {e}")
|
|
113
|
+
"""初始化存储。"""
|
|
114
|
+
from aury.boot.infrastructure.storage import StorageBackend, StorageConfig
|
|
115
|
+
|
|
116
|
+
storage_configs = config.get_storages()
|
|
117
|
+
if not storage_configs:
|
|
118
|
+
logger.debug("未配置 Storage 实例,跳过存储初始化")
|
|
119
|
+
return
|
|
120
|
+
|
|
121
|
+
for name, st_config in storage_configs.items():
|
|
122
|
+
try:
|
|
123
|
+
storage_manager = StorageManager.get_instance(name)
|
|
124
|
+
if not storage_manager.is_initialized:
|
|
125
|
+
storage_config = StorageConfig(
|
|
126
|
+
backend=StorageBackend(st_config.backend),
|
|
127
|
+
access_key_id=st_config.access_key_id,
|
|
128
|
+
access_key_secret=st_config.access_key_secret,
|
|
129
|
+
endpoint=st_config.endpoint,
|
|
130
|
+
region=st_config.region,
|
|
131
|
+
bucket_name=st_config.bucket_name,
|
|
132
|
+
base_path=st_config.base_path,
|
|
133
|
+
)
|
|
134
|
+
await storage_manager.initialize(storage_config)
|
|
135
|
+
except Exception as e:
|
|
136
|
+
logger.warning(f"存储 [{name}] 初始化失败(非关键): {e}")
|
|
138
137
|
|
|
139
138
|
async def teardown(self, app: FoundationApp) -> None:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
"""关闭所有存储实例。"""
|
|
140
|
+
for name in list(StorageManager._instances.keys()):
|
|
141
|
+
try:
|
|
142
|
+
storage_manager = StorageManager.get_instance(name)
|
|
143
|
+
if storage_manager.is_initialized:
|
|
144
|
+
await storage_manager.cleanup()
|
|
145
|
+
except Exception as e:
|
|
146
|
+
logger.warning(f"存储 [{name}] 关闭失败: {e}")
|
|
145
147
|
|
|
146
148
|
|
|
147
149
|
class TaskComponent(Component):
|
|
@@ -410,6 +412,93 @@ class AdminConsoleComponent(Component):
|
|
|
410
412
|
pass
|
|
411
413
|
|
|
412
414
|
|
|
415
|
+
class MessageQueueComponent(Component):
|
|
416
|
+
"""消息队列组件。
|
|
417
|
+
|
|
418
|
+
提供统一的消息队列接口,支持多种后端(Redis、RabbitMQ)。
|
|
419
|
+
与 TaskComponent(基于 Dramatiq)的区别:
|
|
420
|
+
- Task: 异步任务处理(API 发送,Worker 执行)
|
|
421
|
+
- MQ: 通用消息队列(生产者/消费者模式,服务间通信)
|
|
422
|
+
"""
|
|
423
|
+
|
|
424
|
+
name = ComponentName.MESSAGE_QUEUE
|
|
425
|
+
enabled = True
|
|
426
|
+
depends_on: ClassVar[list[str]] = []
|
|
427
|
+
|
|
428
|
+
def can_enable(self, config: BaseConfig) -> bool:
|
|
429
|
+
"""当配置了 MQ 实例时启用。"""
|
|
430
|
+
return self.enabled and bool(config.get_mqs())
|
|
431
|
+
|
|
432
|
+
async def setup(self, app: FoundationApp, config: BaseConfig) -> None:
|
|
433
|
+
"""初始化消息队列。"""
|
|
434
|
+
from aury.boot.application.config import MQInstanceConfig
|
|
435
|
+
|
|
436
|
+
# 从多实例配置加载
|
|
437
|
+
mq_configs = config.get_mqs()
|
|
438
|
+
if not mq_configs:
|
|
439
|
+
logger.debug("未配置 MQ 实例,跳过消息队列初始化")
|
|
440
|
+
return
|
|
441
|
+
|
|
442
|
+
for name, mq_config in mq_configs.items():
|
|
443
|
+
try:
|
|
444
|
+
mq_manager = MQManager.get_instance(name)
|
|
445
|
+
if not mq_manager.is_initialized:
|
|
446
|
+
await mq_manager.initialize(config=mq_config)
|
|
447
|
+
except Exception as e:
|
|
448
|
+
logger.warning(f"消息队列 [{name}] 初始化失败(非关键): {e}")
|
|
449
|
+
|
|
450
|
+
async def teardown(self, app: FoundationApp) -> None:
|
|
451
|
+
"""关闭所有消息队列实例。"""
|
|
452
|
+
for name in list(MQManager._instances.keys()):
|
|
453
|
+
try:
|
|
454
|
+
mq_manager = MQManager.get_instance(name)
|
|
455
|
+
if mq_manager.is_initialized:
|
|
456
|
+
await mq_manager.cleanup()
|
|
457
|
+
except Exception as e:
|
|
458
|
+
logger.warning(f"消息队列 [{name}] 关闭失败: {e}")
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
class EventBusComponent(Component):
|
|
462
|
+
"""事件总线组件。
|
|
463
|
+
|
|
464
|
+
提供发布/订阅模式的事件总线功能,支持多种后端(memory、Redis、RabbitMQ)。
|
|
465
|
+
"""
|
|
466
|
+
|
|
467
|
+
name = ComponentName.EVENT_BUS
|
|
468
|
+
enabled = True
|
|
469
|
+
depends_on: ClassVar[list[str]] = []
|
|
470
|
+
|
|
471
|
+
def can_enable(self, config: BaseConfig) -> bool:
|
|
472
|
+
"""当配置了 Event 实例时启用。"""
|
|
473
|
+
return self.enabled and bool(config.get_events())
|
|
474
|
+
|
|
475
|
+
async def setup(self, app: FoundationApp, config: BaseConfig) -> None:
|
|
476
|
+
"""初始化事件总线。"""
|
|
477
|
+
# 从多实例配置加载
|
|
478
|
+
event_configs = config.get_events()
|
|
479
|
+
if not event_configs:
|
|
480
|
+
logger.debug("未配置 Event 实例,跳过事件总线初始化")
|
|
481
|
+
return
|
|
482
|
+
|
|
483
|
+
for name, event_config in event_configs.items():
|
|
484
|
+
try:
|
|
485
|
+
event_manager = EventBusManager.get_instance(name)
|
|
486
|
+
if not event_manager.is_initialized:
|
|
487
|
+
await event_manager.initialize(config=event_config)
|
|
488
|
+
except Exception as e:
|
|
489
|
+
logger.warning(f"事件总线 [{name}] 初始化失败(非关键): {e}")
|
|
490
|
+
|
|
491
|
+
async def teardown(self, app: FoundationApp) -> None:
|
|
492
|
+
"""关闭所有事件总线实例。"""
|
|
493
|
+
for name in list(EventBusManager._instances.keys()):
|
|
494
|
+
try:
|
|
495
|
+
event_manager = EventBusManager.get_instance(name)
|
|
496
|
+
if event_manager.is_initialized:
|
|
497
|
+
await event_manager.cleanup()
|
|
498
|
+
except Exception as e:
|
|
499
|
+
logger.warning(f"事件总线 [{name}] 关闭失败: {e}")
|
|
500
|
+
|
|
501
|
+
|
|
413
502
|
# 设置默认组件
|
|
414
503
|
FoundationApp.components = [
|
|
415
504
|
DatabaseComponent,
|
|
@@ -418,6 +507,8 @@ FoundationApp.components = [
|
|
|
418
507
|
CacheComponent,
|
|
419
508
|
StorageComponent,
|
|
420
509
|
TaskComponent,
|
|
510
|
+
MessageQueueComponent,
|
|
511
|
+
EventBusComponent,
|
|
421
512
|
SchedulerComponent,
|
|
422
513
|
]
|
|
423
514
|
|
|
@@ -426,6 +517,8 @@ __all__ = [
|
|
|
426
517
|
"AdminConsoleComponent",
|
|
427
518
|
"CacheComponent",
|
|
428
519
|
"DatabaseComponent",
|
|
520
|
+
"EventBusComponent",
|
|
521
|
+
"MessageQueueComponent",
|
|
429
522
|
"MigrationComponent",
|
|
430
523
|
"SchedulerComponent",
|
|
431
524
|
"StorageComponent",
|
|
@@ -13,6 +13,8 @@ from aury.boot.application.config import BaseConfig
|
|
|
13
13
|
from aury.boot.application.constants import MiddlewareName
|
|
14
14
|
from aury.boot.application.middleware.logging import (
|
|
15
15
|
RequestLoggingMiddleware as StarletteRequestLoggingMiddleware,
|
|
16
|
+
)
|
|
17
|
+
from aury.boot.application.middleware.logging import (
|
|
16
18
|
WebSocketLoggingMiddleware as StarletteWebSocketLoggingMiddleware,
|
|
17
19
|
)
|
|
18
20
|
|