aury-boot 0.0.25__py3-none-any.whl → 0.0.26__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.
aury/boot/_version.py CHANGED
@@ -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.25'
32
- __version_tuple__ = version_tuple = (0, 0, 25)
31
+ __version__ = version = '0.0.26'
32
+ __version_tuple__ = version_tuple = (0, 0, 26)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -9,10 +9,34 @@
9
9
 
10
10
  ## 13.1 基本用法
11
11
 
12
+ ### 通过环境变量自动初始化(推荐)
13
+
14
+ 配置环境变量后,`ChannelComponent` 会在应用启动时自动初始化:
15
+
16
+ ```bash
17
+ # .env
18
+ CHANNEL__SSE__BACKEND=memory
19
+ CHANNEL__NOTIFICATION__BACKEND=redis
20
+ CHANNEL__NOTIFICATION__URL=redis://localhost:6379/3
21
+ ```
22
+
23
+ ```python
24
+ from aury.boot.infrastructure.channel import ChannelManager
25
+
26
+ # 直接获取已初始化的实例
27
+ sse_channel = ChannelManager.get_instance("sse")
28
+ notification_channel = ChannelManager.get_instance("notification")
29
+
30
+ # 直接使用
31
+ await sse_channel.publish("user:123", {{"event": "hello"}})
32
+ ```
33
+
34
+ ### 手动初始化
35
+
12
36
  ```python
13
37
  from aury.boot.infrastructure.channel import ChannelManager
14
38
 
15
- # 命名多实例(推荐)- 不同业务场景使用不同实例
39
+ # 命名多实例 - 不同业务场景使用不同实例
16
40
  sse_channel = ChannelManager.get_instance("sse")
17
41
  notification_channel = ChannelManager.get_instance("notification")
18
42
 
@@ -112,21 +136,7 @@ await sse_channel.publish(f"space:{{space_id}}:comment_added", {{
112
136
 
113
137
  Redis 后端使用 Redis 原生 `PSUBSCRIBE`,内存后端使用 `fnmatch` 实现。
114
138
 
115
- ## 13.5 应用场景示例
116
-
117
- ```python
118
- # 不同业务场景使用不同的命名实例
119
- sse_channel = ChannelManager.get_instance("sse") # 前端 SSE 推送
120
- chat_channel = ChannelManager.get_instance("chat") # 聊天消息
121
- notify_channel = ChannelManager.get_instance("notify") # 系统通知
122
-
123
- # 分别初始化(可使用不同后端)
124
- await sse_channel.initialize(backend="memory") # 单进程即可
125
- await chat_channel.initialize(backend="redis", url="redis://localhost:6379/3") # 需要跨进程
126
- await notify_channel.initialize(backend="redis", url="redis://localhost:6379/4")
127
- ```
128
-
129
- ## 13.6 环境变量
139
+ ## 13.5 环境变量
130
140
 
131
141
  ```bash
132
142
  # 默认实例
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aury-boot
3
- Version: 0.0.25
3
+ Version: 0.0.26
4
4
  Summary: Aury Boot - 基于 FastAPI 生态的企业级 API 开发框架
5
5
  Requires-Python: >=3.13
6
6
  Requires-Dist: alembic>=1.17.2
@@ -1,5 +1,5 @@
1
1
  aury/boot/__init__.py,sha256=pCno-EInnpIBa1OtxNYF-JWf9j95Cd2h6vmu0xqa_-4,1791
2
- aury/boot/_version.py,sha256=DspPu1FRRiGe5F0Nbz1wXOpsS5e-m6ETOzBjU5BFWRE,706
2
+ aury/boot/_version.py,sha256=Fnf259POysYSI-aH6DhnxuHUxCVOFWsQLs4I5Ur_KMA,706
3
3
  aury/boot/application/__init__.py,sha256=0o_XmiwFCeAu06VHggS8I1e7_nSMoRq0Hcm0fYfCywU,3071
4
4
  aury/boot/application/adapter/__init__.py,sha256=e1bcSb1bxUMfofTwiCuHBZJk5-STkMCWPF2EJXHQ7UU,3976
5
5
  aury/boot/application/adapter/base.py,sha256=Ar_66fiHPDEmV-1DKnqXKwc53p3pozG31bgTJTEUriY,15763
@@ -81,7 +81,7 @@ aury/boot/commands/templates/project/aury_docs/09-tasks.md.tpl,sha256=swHOQ_pWPt
81
81
  aury/boot/commands/templates/project/aury_docs/10-storage.md.tpl,sha256=mhe0j0S51ndPJLjaQ6yD8OPYBEO02NHumJVbBvz2qkw,4320
82
82
  aury/boot/commands/templates/project/aury_docs/11-logging.md.tpl,sha256=bwxFCGQsO9cTEbwqJF1xcjsZKP82HRWhIMRUS0c9_ZI,2435
83
83
  aury/boot/commands/templates/project/aury_docs/12-admin.md.tpl,sha256=6z3mN54qP2jtpTFOJBLVexvEv0ZHXYKjncvpZG4yOdw,1883
84
- aury/boot/commands/templates/project/aury_docs/13-channel.md.tpl,sha256=SV0XpuzzF7YGwsGm9uswQf0-JQvbJ98rdXOUa2KJm5E,4428
84
+ aury/boot/commands/templates/project/aury_docs/13-channel.md.tpl,sha256=Zw01FNabA2kP2G8jDcjZg-CLndyiMpVYxQzTq8ruLmU,4406
85
85
  aury/boot/commands/templates/project/aury_docs/14-mq.md.tpl,sha256=4bxLQBbCi0Fue0VQWOPt6acZ5P00BoLkCoLPQe_8k4U,2396
86
86
  aury/boot/commands/templates/project/aury_docs/15-events.md.tpl,sha256=a4wQRgVPuYUGTGmw_lX1HJH_yFTbD30mBz7Arc4zgfs,3361
87
87
  aury/boot/commands/templates/project/aury_docs/16-adapter.md.tpl,sha256=pkmJkZw2Ca6_uYk2jZvAb8DozjBa2tWq_t3gtq1lFSk,11456
@@ -192,7 +192,7 @@ aury/boot/testing/client.py,sha256=KOg1EemuIVsBG68G5y0DjSxZGcIQVdWQ4ASaHE3o1R0,4
192
192
  aury/boot/testing/factory.py,sha256=8GvwX9qIDu0L65gzJMlrWB0xbmJ-7zPHuwk3eECULcg,5185
193
193
  aury/boot/toolkit/__init__.py,sha256=AcyVb9fDf3CaEmJPNkWC4iGv32qCPyk4BuFKSuNiJRQ,334
194
194
  aury/boot/toolkit/http/__init__.py,sha256=zIPmpIZ9Qbqe25VmEr7jixoY2fkRbLm7NkCB9vKpg6I,11039
195
- aury_boot-0.0.25.dist-info/METADATA,sha256=ph7zu8UJgX6_LBmEERNW8O6C7nc0afNhYEGz9Qm3rQs,7695
196
- aury_boot-0.0.25.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
197
- aury_boot-0.0.25.dist-info/entry_points.txt,sha256=f9KXEkDIGc0BGkgBvsNx_HMz9VhDjNxu26q00jUpDwQ,49
198
- aury_boot-0.0.25.dist-info/RECORD,,
195
+ aury_boot-0.0.26.dist-info/METADATA,sha256=2M3n6KMCpEnC-1qSDg-b2nvlGwh86HGw15XfljGC2mo,7695
196
+ aury_boot-0.0.26.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
197
+ aury_boot-0.0.26.dist-info/entry_points.txt,sha256=f9KXEkDIGc0BGkgBvsNx_HMz9VhDjNxu26q00jUpDwQ,49
198
+ aury_boot-0.0.26.dist-info/RECORD,,