aury-boot 0.0.2__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 ADDED
@@ -0,0 +1,34 @@
1
+ # file generated by setuptools-scm
2
+ # don't change, don't track in version control
3
+
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
12
+
13
+ TYPE_CHECKING = False
14
+ if TYPE_CHECKING:
15
+ from typing import Tuple
16
+ from typing import Union
17
+
18
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
20
+ else:
21
+ VERSION_TUPLE = object
22
+ COMMIT_ID = object
23
+
24
+ version: str
25
+ __version__: str
26
+ __version_tuple__: VERSION_TUPLE
27
+ version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
30
+
31
+ __version__ = version = '0.0.2'
32
+ __version_tuple__ = version_tuple = (0, 0, 2)
33
+
34
+ __commit_id__ = commit_id = None
@@ -0,0 +1,265 @@
1
+ Metadata-Version: 2.4
2
+ Name: aury-boot
3
+ Version: 0.0.2
4
+ Summary: Aury Boot - 基于 FastAPI 生态的企业级 API 开发框架
5
+ Requires-Python: >=3.13
6
+ Requires-Dist: alembic>=1.17.2
7
+ Requires-Dist: babel>=2.17.0
8
+ Requires-Dist: faker>=38.2.0
9
+ Requires-Dist: fastapi>=0.122.0
10
+ Requires-Dist: greenlet>=3.2.4
11
+ Requires-Dist: httpx>=0.28.1
12
+ Requires-Dist: loguru>=0.7.3
13
+ Requires-Dist: pydantic-settings>=2.12.0
14
+ Requires-Dist: pydantic>=2.12.5
15
+ Requires-Dist: rich>=14.2.0
16
+ Requires-Dist: sqlalchemy>=2.0.44
17
+ Requires-Dist: tenacity>=9.1.2
18
+ Requires-Dist: typer>=0.20.0
19
+ Requires-Dist: uvicorn[standard]>=0.30.0
20
+ Provides-Extra: admin
21
+ Requires-Dist: itsdangerous>=2.2.0; extra == 'admin'
22
+ Requires-Dist: sqladmin>=0.16.0; extra == 'admin'
23
+ Provides-Extra: all
24
+ Requires-Dist: aiomysql>=0.3.2; extra == 'all'
25
+ Requires-Dist: aiosqlite>=0.21.0; extra == 'all'
26
+ Requires-Dist: amqp>=5.3.1; extra == 'all'
27
+ Requires-Dist: apscheduler>=3.11.1; extra == 'all'
28
+ Requires-Dist: asyncpg>=0.31.0; extra == 'all'
29
+ Requires-Dist: aury-sdk-storage[aws]>=0.0.1; extra == 'all'
30
+ Requires-Dist: dramatiq-kombu-broker>=0.2.2; extra == 'all'
31
+ Requires-Dist: dramatiq>=1.18.0; extra == 'all'
32
+ Requires-Dist: kombu>=5.6.1; extra == 'all'
33
+ Requires-Dist: redis>=7.1.0; extra == 'all'
34
+ Provides-Extra: dev
35
+ Requires-Dist: mypy>=1.19.0; extra == 'dev'
36
+ Requires-Dist: pytest-asyncio>=1.3.0; extra == 'dev'
37
+ Requires-Dist: pytest-cov>=7.0.0; extra == 'dev'
38
+ Requires-Dist: pytest>=9.0.1; extra == 'dev'
39
+ Requires-Dist: ruff>=0.14.7; extra == 'dev'
40
+ Provides-Extra: docs
41
+ Requires-Dist: materialx>=1.39.0; extra == 'docs'
42
+ Requires-Dist: mkdocs-material>=9.7.0; extra == 'docs'
43
+ Requires-Dist: mkdocs>=1.6.0; extra == 'docs'
44
+ Provides-Extra: mysql
45
+ Requires-Dist: aiomysql>=0.3.2; extra == 'mysql'
46
+ Provides-Extra: postgres
47
+ Requires-Dist: asyncpg>=0.31.0; extra == 'postgres'
48
+ Provides-Extra: rabbitmq
49
+ Requires-Dist: amqp>=5.3.1; extra == 'rabbitmq'
50
+ Provides-Extra: recommended
51
+ Requires-Dist: apscheduler>=3.11.1; extra == 'recommended'
52
+ Requires-Dist: asyncpg>=0.31.0; extra == 'recommended'
53
+ Requires-Dist: aury-sdk-storage[aws]>=0.0.1; extra == 'recommended'
54
+ Requires-Dist: dramatiq-kombu-broker>=0.2.2; extra == 'recommended'
55
+ Requires-Dist: dramatiq>=1.18.0; extra == 'recommended'
56
+ Requires-Dist: kombu>=5.6.1; extra == 'recommended'
57
+ Requires-Dist: redis>=7.1.0; extra == 'recommended'
58
+ Provides-Extra: redis
59
+ Requires-Dist: redis>=7.1.0; extra == 'redis'
60
+ Provides-Extra: s3
61
+ Requires-Dist: aury-sdk-storage[aws]>=0.0.1; extra == 's3'
62
+ Provides-Extra: scheduler
63
+ Requires-Dist: apscheduler>=3.11.1; extra == 'scheduler'
64
+ Provides-Extra: sqlite
65
+ Requires-Dist: aiosqlite>=0.21.0; extra == 'sqlite'
66
+ Provides-Extra: tasks
67
+ Requires-Dist: dramatiq-kombu-broker>=0.2.2; extra == 'tasks'
68
+ Requires-Dist: dramatiq>=1.18.0; extra == 'tasks'
69
+ Requires-Dist: kombu>=5.6.1; extra == 'tasks'
70
+ Description-Content-Type: text/markdown
71
+
72
+ # Aury Boot
73
+
74
+ 这是AUM项目的基于 FastAPI 生态的企业级 API 开发框架,提供所有微服务共用的基础设施组件。
75
+
76
+ ## 功能模块
77
+
78
+ - **core**: 核心功能(数据库、缓存、任务调度等)
79
+ - **utils**: 工具函数(日志、安全、HTTP客户端等)
80
+ - **models**: 共享数据模型和响应模型
81
+ - **repositories**: 基础仓储模式
82
+ - **services**: 基础服务类
83
+ - **adapters**: 第三方服务适配器
84
+ - **rpc**: RPC通信框架
85
+ - **exceptions**: 错误处理系统
86
+ - **i18n**: 国际化支持
87
+ - **testing**: 测试框架
88
+ - **migrations**: 数据库迁移工具
89
+
90
+ ## 主要功能
91
+
92
+ ### 1. 国际化支持 (i18n)
93
+
94
+ 提供完整的多语言支持,包括文本翻译、日期/数字本地化等:
95
+
96
+ ```python
97
+ from aury.boot.i18n import Translator, translate, set_locale
98
+
99
+ # 设置语言环境
100
+ set_locale("zh_CN")
101
+
102
+ # 使用翻译器
103
+ translator = Translator(locale="zh_CN")
104
+ message = translator.translate("user.created", name="张三")
105
+
106
+ # 使用简写函数
107
+ message = translate("user.created", name="张三")
108
+
109
+ # 装饰器方式
110
+ @_("user.title")
111
+ def get_user_title():
112
+ return "User Title" # 会被翻译
113
+ ```
114
+
115
+ ### 2. 测试框架
116
+
117
+ 提供便捷的测试工具,包括测试基类、测试客户端、数据工厂等:
118
+
119
+ ```python
120
+ from aury.boot.testing import TestCase, TestClient, Factory
121
+
122
+ class UserServiceTest(TestCase):
123
+ """测试基类,自动处理数据库事务回滚"""
124
+
125
+ async def setUp(self):
126
+ """测试前准备"""
127
+ self.client = TestClient(app)
128
+ self.user_factory = Factory(User)
129
+
130
+ async def test_create_user(self):
131
+ """测试创建用户"""
132
+ user = await self.user_factory.create(name="张三")
133
+ response = await self.client.post("/users", json={"name": "张三"})
134
+ assert response.status_code == 201
135
+ ```
136
+
137
+ ### 3. 数据库迁移工具
138
+
139
+ 提供便捷的数据库迁移管理,类似 Django 的命令行接口:
140
+
141
+ ```python
142
+ from aury.boot.migrations import MigrationManager
143
+
144
+ # 使用 Python API
145
+ migration_manager = MigrationManager()
146
+ await migration_manager.make_migrations(message="add user table")
147
+ await migration_manager.migrate_up()
148
+ await migration_manager.migrate_down(version="previous")
149
+ status = await migration_manager.status()
150
+ ```
151
+
152
+ 命令行工具:
153
+
154
+ ```bash
155
+ # 生成迁移文件
156
+ aury migrate make -m "add user table"
157
+
158
+ # 执行迁移
159
+ aury migrate up
160
+
161
+ # 回滚迁移
162
+ aury migrate down
163
+
164
+ # 查看状态
165
+ aury migrate status
166
+
167
+ # 显示迁移历史
168
+ aury migrate show
169
+ ```
170
+
171
+ ### 4. 代码生成器
172
+
173
+ 快速生成标准的 CRUD 代码(模型、仓储、服务、API 路由):
174
+
175
+ ```bash
176
+ # 生成完整 CRUD(Model + Repository + Service + API)
177
+ aury generate crud user
178
+
179
+ # 单独生成各层代码
180
+ aury generate model user # SQLAlchemy 模型
181
+ aury generate repo user # Repository 仓储层
182
+ aury generate service user # Service 服务层
183
+ aury generate api user # API 路由
184
+
185
+ # 交互式生成(推荐):逐步选择字段、类型、验证规则
186
+ aury generate crud user -i
187
+ aury generate model user -i
188
+
189
+ # 指定字段(非交互式)
190
+ aury generate model user --fields "name:str,email:str,age:int"
191
+ ```
192
+
193
+ **交互式模式 (`-i`)** 会引导你:
194
+ - 添加字段名称和类型
195
+ - 设置字段约束(唯一、可空、默认值等)
196
+ - 配置关系字段(外键、多对多等)
197
+ - 自动插入 API 路由到 `api/__init__.py`
198
+
199
+ 生成的代码遵循项目架构模式,开箱即用。
200
+
201
+ ## 使用方式
202
+
203
+ 在AUM工作区内的其他包中,可以直接导入:
204
+
205
+ ```python
206
+ from aury.boot.infrastructure.database import DatabaseManager
207
+ from aury.boot.infrastructure.logging import logger
208
+ from aury.boot.core import BaseModel, BaseRepository, BaseService
209
+ from aury.boot.interfaces import BaseRequest, BaseResponse
210
+ from aury.boot.application.rpc import RPCClient
211
+ ```
212
+
213
+ ## 开发指南
214
+
215
+ 修改此包后,所有依赖它的服务都会自动使用最新版本,无需重新安装。
216
+
217
+ ## 安装
218
+
219
+ ```bash
220
+ # 推荐(PostgreSQL + Redis + 任务队列 + 调度器)
221
+ uv add "aury-boot[recommended]"
222
+
223
+ # 或按需组合
224
+ uv add "aury-boot[postgres,redis]"
225
+
226
+ # 全部依赖
227
+ uv add "aury-boot[all]"
228
+ ```
229
+
230
+ ### 可选依赖
231
+
232
+ | 名称 | 说明 |
233
+ |------|------|
234
+ | `postgres` | PostgreSQL 数据库 |
235
+ | `mysql` | MySQL 数据库 |
236
+ | `sqlite` | SQLite 数据库 |
237
+ | `redis` | Redis 缓存 |
238
+ | `s3` | S3 对象存储 |
239
+ | `tasks` | 任务队列 |
240
+ | `rabbitmq` | RabbitMQ 支持 |
241
+ | `scheduler` | 定时调度 |
242
+ | `recommended` | 推荐组合 |
243
+ | `all` | 全部依赖 |
244
+
245
+ ## 开发环境设置
246
+
247
+ ```bash
248
+ # 克隆仓库
249
+ git clone https://github.com/AUMNeo/aury-boot.git
250
+ cd aury-boot
251
+
252
+ # 安装依赖
253
+ uv sync --group dev
254
+
255
+ # 运行测试
256
+ pytest
257
+
258
+ # 代码检查
259
+ ruff check .
260
+ mypy aury/
261
+ ```
262
+
263
+
264
+
265
+
@@ -0,0 +1,5 @@
1
+ aury/boot/_version.py,sha256=huLsL1iGeXWQKZ8bjwDdIWC7JOkj3wnzBh-HFMZl1PY,704
2
+ aury_boot-0.0.2.dist-info/METADATA,sha256=O35zvOV0h64w70I_4KfTd0hJUz_LjlTt_5RBgA5xEeo,7554
3
+ aury_boot-0.0.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
4
+ aury_boot-0.0.2.dist-info/entry_points.txt,sha256=f9KXEkDIGc0BGkgBvsNx_HMz9VhDjNxu26q00jUpDwQ,49
5
+ aury_boot-0.0.2.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ aury = aury.boot.commands:main