aury-boot 0.0.4__py3-none-any.whl → 0.0.7__py3-none-any.whl

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 (122) hide show
  1. aury/boot/__init__.py +2 -2
  2. aury/boot/_version.py +2 -2
  3. aury/boot/application/__init__.py +60 -36
  4. aury/boot/application/adapter/__init__.py +112 -0
  5. aury/boot/application/adapter/base.py +511 -0
  6. aury/boot/application/adapter/config.py +242 -0
  7. aury/boot/application/adapter/decorators.py +259 -0
  8. aury/boot/application/adapter/exceptions.py +202 -0
  9. aury/boot/application/adapter/http.py +325 -0
  10. aury/boot/application/app/__init__.py +12 -8
  11. aury/boot/application/app/base.py +12 -0
  12. aury/boot/application/app/components.py +137 -44
  13. aury/boot/application/app/middlewares.py +9 -4
  14. aury/boot/application/app/startup.py +249 -0
  15. aury/boot/application/config/__init__.py +36 -1
  16. aury/boot/application/config/multi_instance.py +216 -0
  17. aury/boot/application/config/settings.py +398 -149
  18. aury/boot/application/constants/components.py +6 -0
  19. aury/boot/application/errors/handlers.py +17 -3
  20. aury/boot/application/middleware/logging.py +21 -120
  21. aury/boot/application/rpc/__init__.py +2 -2
  22. aury/boot/commands/__init__.py +30 -10
  23. aury/boot/commands/app.py +131 -1
  24. aury/boot/commands/docs.py +104 -17
  25. aury/boot/commands/generate.py +22 -22
  26. aury/boot/commands/init.py +68 -17
  27. aury/boot/commands/server/app.py +2 -3
  28. aury/boot/commands/templates/project/AGENTS.md.tpl +221 -0
  29. aury/boot/commands/templates/project/README.md.tpl +2 -2
  30. aury/boot/commands/templates/project/aury_docs/00-overview.md.tpl +59 -0
  31. aury/boot/commands/templates/project/aury_docs/01-model.md.tpl +184 -0
  32. aury/boot/commands/templates/project/aury_docs/02-repository.md.tpl +206 -0
  33. aury/boot/commands/templates/project/aury_docs/03-service.md.tpl +398 -0
  34. aury/boot/commands/templates/project/aury_docs/04-schema.md.tpl +95 -0
  35. aury/boot/commands/templates/project/aury_docs/05-api.md.tpl +116 -0
  36. aury/boot/commands/templates/project/aury_docs/06-exception.md.tpl +118 -0
  37. aury/boot/commands/templates/project/aury_docs/07-cache.md.tpl +122 -0
  38. aury/boot/commands/templates/project/aury_docs/08-scheduler.md.tpl +32 -0
  39. aury/boot/commands/templates/project/aury_docs/09-tasks.md.tpl +38 -0
  40. aury/boot/commands/templates/project/aury_docs/10-storage.md.tpl +115 -0
  41. aury/boot/commands/templates/project/aury_docs/11-logging.md.tpl +131 -0
  42. aury/boot/commands/templates/project/aury_docs/12-admin.md.tpl +56 -0
  43. aury/boot/commands/templates/project/aury_docs/13-channel.md.tpl +104 -0
  44. aury/boot/commands/templates/project/aury_docs/14-mq.md.tpl +102 -0
  45. aury/boot/commands/templates/project/aury_docs/15-events.md.tpl +147 -0
  46. aury/boot/commands/templates/project/aury_docs/16-adapter.md.tpl +403 -0
  47. aury/boot/commands/templates/project/{CLI.md.tpl → aury_docs/99-cli.md.tpl} +19 -19
  48. aury/boot/commands/templates/project/config.py.tpl +10 -10
  49. aury/boot/commands/templates/project/env_templates/_header.tpl +10 -0
  50. aury/boot/commands/templates/project/env_templates/admin.tpl +49 -0
  51. aury/boot/commands/templates/project/env_templates/cache.tpl +14 -0
  52. aury/boot/commands/templates/project/env_templates/database.tpl +22 -0
  53. aury/boot/commands/templates/project/env_templates/log.tpl +18 -0
  54. aury/boot/commands/templates/project/env_templates/messaging.tpl +46 -0
  55. aury/boot/commands/templates/project/env_templates/rpc.tpl +28 -0
  56. aury/boot/commands/templates/project/env_templates/scheduler.tpl +18 -0
  57. aury/boot/commands/templates/project/env_templates/service.tpl +18 -0
  58. aury/boot/commands/templates/project/env_templates/storage.tpl +38 -0
  59. aury/boot/commands/templates/project/env_templates/third_party.tpl +43 -0
  60. aury/boot/commands/templates/project/modules/tasks.py.tpl +1 -1
  61. aury/boot/common/logging/__init__.py +26 -674
  62. aury/boot/common/logging/context.py +132 -0
  63. aury/boot/common/logging/decorators.py +118 -0
  64. aury/boot/common/logging/format.py +315 -0
  65. aury/boot/common/logging/setup.py +214 -0
  66. aury/boot/contrib/admin_console/auth.py +2 -3
  67. aury/boot/contrib/admin_console/install.py +1 -1
  68. aury/boot/domain/models/mixins.py +48 -1
  69. aury/boot/domain/pagination/__init__.py +94 -0
  70. aury/boot/domain/repository/impl.py +1 -1
  71. aury/boot/domain/repository/interface.py +1 -1
  72. aury/boot/domain/transaction/__init__.py +8 -9
  73. aury/boot/infrastructure/__init__.py +86 -29
  74. aury/boot/infrastructure/cache/backends.py +102 -18
  75. aury/boot/infrastructure/cache/base.py +12 -0
  76. aury/boot/infrastructure/cache/manager.py +153 -91
  77. aury/boot/infrastructure/channel/__init__.py +24 -0
  78. aury/boot/infrastructure/channel/backends/__init__.py +9 -0
  79. aury/boot/infrastructure/channel/backends/memory.py +83 -0
  80. aury/boot/infrastructure/channel/backends/redis.py +88 -0
  81. aury/boot/infrastructure/channel/base.py +92 -0
  82. aury/boot/infrastructure/channel/manager.py +203 -0
  83. aury/boot/infrastructure/clients/__init__.py +22 -0
  84. aury/boot/infrastructure/clients/rabbitmq/__init__.py +9 -0
  85. aury/boot/infrastructure/clients/rabbitmq/config.py +46 -0
  86. aury/boot/infrastructure/clients/rabbitmq/manager.py +288 -0
  87. aury/boot/infrastructure/clients/redis/__init__.py +28 -0
  88. aury/boot/infrastructure/clients/redis/config.py +51 -0
  89. aury/boot/infrastructure/clients/redis/manager.py +264 -0
  90. aury/boot/infrastructure/database/config.py +7 -16
  91. aury/boot/infrastructure/database/manager.py +16 -38
  92. aury/boot/infrastructure/events/__init__.py +18 -21
  93. aury/boot/infrastructure/events/backends/__init__.py +11 -0
  94. aury/boot/infrastructure/events/backends/memory.py +86 -0
  95. aury/boot/infrastructure/events/backends/rabbitmq.py +193 -0
  96. aury/boot/infrastructure/events/backends/redis.py +162 -0
  97. aury/boot/infrastructure/events/base.py +127 -0
  98. aury/boot/infrastructure/events/manager.py +224 -0
  99. aury/boot/infrastructure/mq/__init__.py +24 -0
  100. aury/boot/infrastructure/mq/backends/__init__.py +9 -0
  101. aury/boot/infrastructure/mq/backends/rabbitmq.py +179 -0
  102. aury/boot/infrastructure/mq/backends/redis.py +167 -0
  103. aury/boot/infrastructure/mq/base.py +143 -0
  104. aury/boot/infrastructure/mq/manager.py +239 -0
  105. aury/boot/infrastructure/scheduler/manager.py +7 -3
  106. aury/boot/infrastructure/storage/__init__.py +9 -9
  107. aury/boot/infrastructure/storage/base.py +17 -5
  108. aury/boot/infrastructure/storage/factory.py +0 -1
  109. aury/boot/infrastructure/tasks/__init__.py +2 -2
  110. aury/boot/infrastructure/tasks/config.py +5 -13
  111. aury/boot/infrastructure/tasks/manager.py +55 -33
  112. {aury_boot-0.0.4.dist-info → aury_boot-0.0.7.dist-info}/METADATA +20 -2
  113. aury_boot-0.0.7.dist-info/RECORD +197 -0
  114. aury/boot/commands/templates/project/DEVELOPMENT.md.tpl +0 -1397
  115. aury/boot/commands/templates/project/env.example.tpl +0 -213
  116. aury/boot/infrastructure/events/bus.py +0 -362
  117. aury/boot/infrastructure/events/config.py +0 -52
  118. aury/boot/infrastructure/events/consumer.py +0 -134
  119. aury/boot/infrastructure/events/models.py +0 -63
  120. aury_boot-0.0.4.dist-info/RECORD +0 -137
  121. {aury_boot-0.0.4.dist-info → aury_boot-0.0.7.dist-info}/WHEEL +0 -0
  122. {aury_boot-0.0.4.dist-info → aury_boot-0.0.7.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,18 @@
1
+
2
+ # =============================================================================
3
+ # 调度器配置 (SCHEDULER__)
4
+ # =============================================================================
5
+ # 是否在 API 服务中启用内嵌调度器
6
+ # SCHEDULER__ENABLED=true
7
+ # 定时任务模块列表(为空时自动发现 schedules 模块)
8
+ # SCHEDULER__SCHEDULE_MODULES=[]
9
+
10
+ # =============================================================================
11
+ # 任务队列配置 (TASK__)
12
+ # =============================================================================
13
+ # 任务队列代理 URL(如 Redis 或 RabbitMQ)
14
+ # TASK__BROKER_URL=redis://localhost:6379/1
15
+ # 最大重试次数
16
+ # TASK__MAX_RETRIES=3
17
+ # 任务超时时间(秒)
18
+ # TASK__TIMEOUT=3600
@@ -0,0 +1,18 @@
1
+
2
+ # =============================================================================
3
+ # 服务配置 (SERVICE__)
4
+ # =============================================================================
5
+ # 服务名称,用于日志目录区分
6
+ SERVICE__NAME={project_name_snake}
7
+ # 服务类型: api / worker
8
+ # SERVICE__TYPE=api
9
+
10
+ # =============================================================================
11
+ # 服务器配置 (SERVER__)
12
+ # =============================================================================
13
+ # SERVER__HOST=*********
14
+ # SERVER__PORT=8000
15
+ # 工作进程数(生产环境建议设为 CPU 核心数)
16
+ # SERVER__WORKERS=1
17
+ # 是否启用热重载(生产环境应设为 false)
18
+ # SERVER__RELOAD=true
@@ -0,0 +1,38 @@
1
+
2
+ # =============================================================================
3
+ # 数据库迁移配置 (MIGRATION__)
4
+ # =============================================================================
5
+ # Alembic 配置文件路径
6
+ # MIGRATION__CONFIG_PATH=alembic.ini
7
+ # Alembic 迁移脚本目录
8
+ # MIGRATION__SCRIPT_LOCATION=migrations
9
+ # 是否自动创建迁移配置和目录
10
+ # MIGRATION__AUTO_CREATE=true
11
+
12
+ # =============================================================================
13
+ # 对象存储配置 (STORAGE__) - 基于 aury-sdk-storage
14
+ # =============================================================================
15
+ # 是否启用存储组件
16
+ # STORAGE__ENABLED=true
17
+ # 存储类型: local / s3 / cos / oss
18
+ # STORAGE__TYPE=local
19
+ #
20
+ # 本地存储(开发环境)
21
+ # STORAGE__BASE_PATH=./storage
22
+ #
23
+ # S3/COS/OSS 通用配置
24
+ # STORAGE__ACCESS_KEY_ID=AKIDxxxxx
25
+ # STORAGE__ACCESS_KEY_SECRET=xxxxx
26
+ # STORAGE__SESSION_TOKEN=
27
+ # STORAGE__ENDPOINT=https://cos.ap-guangzhou.myqcloud.com
28
+ # STORAGE__REGION=ap-guangzhou
29
+ # STORAGE__BUCKET_NAME=my-bucket-1250000000
30
+ # STORAGE__ADDRESSING_STYLE=virtual
31
+ #
32
+ # STS AssumeRole(可选,服务端自动刷新凭证)
33
+ # STORAGE__ROLE_ARN=
34
+ # STORAGE__ROLE_SESSION_NAME=aury-storage
35
+ # STORAGE__EXTERNAL_ID=
36
+ # STORAGE__STS_ENDPOINT=
37
+ # STORAGE__STS_REGION=
38
+ # STORAGE__STS_DURATION_SECONDS=3600
@@ -0,0 +1,43 @@
1
+
2
+ # =============================================================================
3
+ # 第三方接口适配器配置 (THIRD_PARTY__)
4
+ # =============================================================================
5
+ # 用于配置支付、短信、微信等第三方接口的模式切换和挡板设置
6
+ # 格式: THIRD_PARTY__{{ADAPTER_NAME}}__{{FIELD}}
7
+ #
8
+ # 模式说明:
9
+ # - real: 真实调用第三方接口(生产环境)
10
+ # - sandbox: 调用第三方沙箱环境(如果有)
11
+ # - mock: 使用本地挡板实现,不发出真实请求(测试/开发环境)
12
+ # - disabled: 禁用该接口,调用时抛出 AdapterDisabledError
13
+ #
14
+ # ---------- 支付接口示例 (PAYMENT) ----------
15
+ # THIRD_PARTY__PAYMENT__ENABLED=true
16
+ # THIRD_PARTY__PAYMENT__MODE=mock
17
+ # THIRD_PARTY__PAYMENT__BASE_URL=https://api.payment.com/v1
18
+ # THIRD_PARTY__PAYMENT__SANDBOX_URL=https://sandbox.payment.com/v1
19
+ # THIRD_PARTY__PAYMENT__API_KEY=sk_live_xxx
20
+ # THIRD_PARTY__PAYMENT__API_SECRET=
21
+ # THIRD_PARTY__PAYMENT__TIMEOUT=30
22
+ # THIRD_PARTY__PAYMENT__RETRY_TIMES=3
23
+ # THIRD_PARTY__PAYMENT__METHOD_MODES={"query": "real", "refund": "disabled"}
24
+ # THIRD_PARTY__PAYMENT__MOCK_STRATEGY=success
25
+ # THIRD_PARTY__PAYMENT__MOCK_DELAY=0.1
26
+ # THIRD_PARTY__PAYMENT__MOCK_DEFAULT_RESPONSE={"success": true, "mock": true}
27
+ #
28
+ # ---------- 短信接口示例 (SMS) ----------
29
+ # THIRD_PARTY__SMS__ENABLED=true
30
+ # THIRD_PARTY__SMS__MODE=mock
31
+ # THIRD_PARTY__SMS__BASE_URL=https://sms.aliyuncs.com
32
+ # THIRD_PARTY__SMS__API_KEY=LTAI5xxx
33
+ # THIRD_PARTY__SMS__API_SECRET=xxx
34
+ # THIRD_PARTY__SMS__TIMEOUT=10
35
+ # THIRD_PARTY__SMS__MOCK_STRATEGY=success
36
+ # THIRD_PARTY__SMS__MOCK_DEFAULT_RESPONSE={"code": "OK", "message": "mock sent"}
37
+ #
38
+ # ---------- 微信接口示例 (WECHAT) ----------
39
+ # THIRD_PARTY__WECHAT__ENABLED=true
40
+ # THIRD_PARTY__WECHAT__MODE=mock
41
+ # THIRD_PARTY__WECHAT__BASE_URL=https://api.weixin.qq.com
42
+ # THIRD_PARTY__WECHAT__TIMEOUT=15
43
+ # THIRD_PARTY__WECHAT__EXTRA={"appid": "wx123", "secret": "xxx"}
@@ -13,7 +13,7 @@
13
13
  # from aury.boot.infrastructure.tasks import conditional_task
14
14
  #
15
15
  #
16
- # @conditional_task
16
+ # @conditional_task()
17
17
  # def example_task():
18
18
  # """示例异步任务。"""
19
19
  # logger.info("异步任务执行中...")