infomankit 0.3.23__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.
- infoman/__init__.py +1 -0
- infoman/cli/README.md +378 -0
- infoman/cli/__init__.py +7 -0
- infoman/cli/commands/__init__.py +3 -0
- infoman/cli/commands/init.py +312 -0
- infoman/cli/scaffold.py +634 -0
- infoman/cli/templates/Makefile.template +132 -0
- infoman/cli/templates/app/__init__.py.template +3 -0
- infoman/cli/templates/app/app.py.template +4 -0
- infoman/cli/templates/app/models_base.py.template +18 -0
- infoman/cli/templates/app/models_entity_init.py.template +11 -0
- infoman/cli/templates/app/models_schemas_init.py.template +11 -0
- infoman/cli/templates/app/repository_init.py.template +11 -0
- infoman/cli/templates/app/routers_init.py.template +15 -0
- infoman/cli/templates/app/services_init.py.template +11 -0
- infoman/cli/templates/app/static_index.html.template +39 -0
- infoman/cli/templates/app/static_main.js.template +31 -0
- infoman/cli/templates/app/static_style.css.template +111 -0
- infoman/cli/templates/app/utils_init.py.template +11 -0
- infoman/cli/templates/config/.env.dev.template +43 -0
- infoman/cli/templates/config/.env.prod.template +43 -0
- infoman/cli/templates/config/README.md.template +28 -0
- infoman/cli/templates/docker/.dockerignore.template +60 -0
- infoman/cli/templates/docker/Dockerfile.template +47 -0
- infoman/cli/templates/docker/README.md.template +240 -0
- infoman/cli/templates/docker/docker-compose.yml.template +81 -0
- infoman/cli/templates/docker/mysql_custom.cnf.template +42 -0
- infoman/cli/templates/docker/mysql_init.sql.template +15 -0
- infoman/cli/templates/project/.env.example.template +1 -0
- infoman/cli/templates/project/.gitignore.template +60 -0
- infoman/cli/templates/project/Makefile.template +38 -0
- infoman/cli/templates/project/README.md.template +137 -0
- infoman/cli/templates/project/deploy.sh.template +97 -0
- infoman/cli/templates/project/main.py.template +10 -0
- infoman/cli/templates/project/manage.sh.template +97 -0
- infoman/cli/templates/project/pyproject.toml.template +47 -0
- infoman/cli/templates/project/service.sh.template +203 -0
- infoman/config/__init__.py +25 -0
- infoman/config/base.py +67 -0
- infoman/config/db_cache.py +237 -0
- infoman/config/db_relation.py +181 -0
- infoman/config/db_vector.py +39 -0
- infoman/config/jwt.py +16 -0
- infoman/config/llm.py +16 -0
- infoman/config/log.py +627 -0
- infoman/config/mq.py +26 -0
- infoman/config/settings.py +65 -0
- infoman/llm/__init__.py +0 -0
- infoman/llm/llm.py +297 -0
- infoman/logger/__init__.py +57 -0
- infoman/logger/context.py +191 -0
- infoman/logger/core.py +358 -0
- infoman/logger/filters.py +157 -0
- infoman/logger/formatters.py +138 -0
- infoman/logger/handlers.py +276 -0
- infoman/logger/metrics.py +160 -0
- infoman/performance/README.md +583 -0
- infoman/performance/__init__.py +19 -0
- infoman/performance/cli.py +215 -0
- infoman/performance/config.py +166 -0
- infoman/performance/reporter.py +519 -0
- infoman/performance/runner.py +303 -0
- infoman/performance/standards.py +222 -0
- infoman/service/__init__.py +8 -0
- infoman/service/app.py +67 -0
- infoman/service/core/__init__.py +0 -0
- infoman/service/core/auth.py +105 -0
- infoman/service/core/lifespan.py +132 -0
- infoman/service/core/monitor.py +57 -0
- infoman/service/core/response.py +37 -0
- infoman/service/exception/__init__.py +7 -0
- infoman/service/exception/error.py +274 -0
- infoman/service/exception/exception.py +25 -0
- infoman/service/exception/handler.py +238 -0
- infoman/service/infrastructure/__init__.py +8 -0
- infoman/service/infrastructure/base.py +212 -0
- infoman/service/infrastructure/db_cache/__init__.py +8 -0
- infoman/service/infrastructure/db_cache/manager.py +194 -0
- infoman/service/infrastructure/db_relation/__init__.py +41 -0
- infoman/service/infrastructure/db_relation/manager.py +300 -0
- infoman/service/infrastructure/db_relation/manager_pro.py +408 -0
- infoman/service/infrastructure/db_relation/mysql.py +52 -0
- infoman/service/infrastructure/db_relation/pgsql.py +54 -0
- infoman/service/infrastructure/db_relation/sqllite.py +25 -0
- infoman/service/infrastructure/db_vector/__init__.py +40 -0
- infoman/service/infrastructure/db_vector/manager.py +201 -0
- infoman/service/infrastructure/db_vector/qdrant.py +322 -0
- infoman/service/infrastructure/mq/__init__.py +15 -0
- infoman/service/infrastructure/mq/manager.py +178 -0
- infoman/service/infrastructure/mq/nats/__init__.py +0 -0
- infoman/service/infrastructure/mq/nats/nats_client.py +57 -0
- infoman/service/infrastructure/mq/nats/nats_event_router.py +25 -0
- infoman/service/launch.py +284 -0
- infoman/service/middleware/__init__.py +7 -0
- infoman/service/middleware/base.py +41 -0
- infoman/service/middleware/logging.py +51 -0
- infoman/service/middleware/rate_limit.py +301 -0
- infoman/service/middleware/request_id.py +21 -0
- infoman/service/middleware/white_list.py +24 -0
- infoman/service/models/__init__.py +8 -0
- infoman/service/models/base.py +441 -0
- infoman/service/models/type/embed.py +70 -0
- infoman/service/routers/__init__.py +18 -0
- infoman/service/routers/health_router.py +311 -0
- infoman/service/routers/monitor_router.py +44 -0
- infoman/service/utils/__init__.py +8 -0
- infoman/service/utils/cache/__init__.py +0 -0
- infoman/service/utils/cache/cache.py +192 -0
- infoman/service/utils/module_loader.py +10 -0
- infoman/service/utils/parse.py +10 -0
- infoman/service/utils/resolver/__init__.py +8 -0
- infoman/service/utils/resolver/base.py +47 -0
- infoman/service/utils/resolver/resp.py +102 -0
- infoman/service/vector/__init__.py +20 -0
- infoman/service/vector/base.py +56 -0
- infoman/service/vector/qdrant.py +125 -0
- infoman/service/vector/service.py +67 -0
- infoman/utils/__init__.py +2 -0
- infoman/utils/decorators/__init__.py +8 -0
- infoman/utils/decorators/cache.py +137 -0
- infoman/utils/decorators/retry.py +99 -0
- infoman/utils/decorators/safe_execute.py +99 -0
- infoman/utils/decorators/timing.py +99 -0
- infoman/utils/encryption/__init__.py +8 -0
- infoman/utils/encryption/aes.py +66 -0
- infoman/utils/encryption/ecc.py +108 -0
- infoman/utils/encryption/rsa.py +112 -0
- infoman/utils/file/__init__.py +0 -0
- infoman/utils/file/handler.py +22 -0
- infoman/utils/hash/__init__.py +0 -0
- infoman/utils/hash/hash.py +61 -0
- infoman/utils/http/__init__.py +8 -0
- infoman/utils/http/client.py +62 -0
- infoman/utils/http/info.py +94 -0
- infoman/utils/http/result.py +19 -0
- infoman/utils/notification/__init__.py +8 -0
- infoman/utils/notification/feishu.py +35 -0
- infoman/utils/text/__init__.py +8 -0
- infoman/utils/text/extractor.py +111 -0
- infomankit-0.3.23.dist-info/METADATA +632 -0
- infomankit-0.3.23.dist-info/RECORD +143 -0
- infomankit-0.3.23.dist-info/WHEEL +4 -0
- infomankit-0.3.23.dist-info/entry_points.txt +5 -0
|
@@ -0,0 +1,632 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: infomankit
|
|
3
|
+
Version: 0.3.23
|
|
4
|
+
Summary: Infoman base library - A comprehensive toolkit for modern Python applications with dual ORM support
|
|
5
|
+
Project-URL: Homepage, https://github.com/infoman-lib/infoman-pykit
|
|
6
|
+
Project-URL: Documentation, https://github.com/infoman-lib/infoman-pykit
|
|
7
|
+
Project-URL: Repository, https://github.com/infoman-lib/infoman-pykit.git
|
|
8
|
+
Project-URL: Issues, https://github.com/infoman-lib/infoman-pykit/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/infoman-lib/infoman-pykit/blob/main/CHANGELOG.md
|
|
10
|
+
Author-email: Louis <louishwh@gmail.com>
|
|
11
|
+
Maintainer-email: Louis <louishwh@gmail.com>
|
|
12
|
+
License: MIT
|
|
13
|
+
Keywords: async,database,fastapi,llm,toolkit
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Framework :: AsyncIO
|
|
16
|
+
Classifier: Framework :: FastAPI
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.11
|
|
25
|
+
Requires-Dist: aiohttp~=3.13.2
|
|
26
|
+
Requires-Dist: click~=8.1.0
|
|
27
|
+
Requires-Dist: cryptography~=46.0.3
|
|
28
|
+
Requires-Dist: dotenv==0.9.9
|
|
29
|
+
Requires-Dist: httpx~=0.28.1
|
|
30
|
+
Requires-Dist: loguru~=0.7.0
|
|
31
|
+
Requires-Dist: psutil~=7.1.3
|
|
32
|
+
Requires-Dist: pydantic-settings>=2.12.0
|
|
33
|
+
Requires-Dist: pydantic~=2.12.0
|
|
34
|
+
Requires-Dist: pyjwt~=2.10.0
|
|
35
|
+
Requires-Dist: pyyaml~=6.0.2
|
|
36
|
+
Provides-Extra: cache
|
|
37
|
+
Requires-Dist: fastapi-cache2~=0.2.2; extra == 'cache'
|
|
38
|
+
Requires-Dist: redis[hiredis]~=7.1.0; extra == 'cache'
|
|
39
|
+
Provides-Extra: database
|
|
40
|
+
Requires-Dist: aiosqlite~=0.22.0; extra == 'database'
|
|
41
|
+
Requires-Dist: asyncmy~=0.2.10; extra == 'database'
|
|
42
|
+
Requires-Dist: asyncpg~=0.31.0; extra == 'database'
|
|
43
|
+
Requires-Dist: tortoise-orm~=0.25.2; extra == 'database'
|
|
44
|
+
Provides-Extra: database-pro
|
|
45
|
+
Requires-Dist: aiosqlite~=0.22.0; extra == 'database-pro'
|
|
46
|
+
Requires-Dist: alembic~=1.14.0; extra == 'database-pro'
|
|
47
|
+
Requires-Dist: asyncmy~=0.2.10; extra == 'database-pro'
|
|
48
|
+
Requires-Dist: asyncpg~=0.31.0; extra == 'database-pro'
|
|
49
|
+
Requires-Dist: sqlalchemy[asyncio]~=2.0.36; extra == 'database-pro'
|
|
50
|
+
Provides-Extra: dev
|
|
51
|
+
Requires-Dist: mypy>=1.8.0; extra == 'dev'
|
|
52
|
+
Requires-Dist: pre-commit>=3.6.0; extra == 'dev'
|
|
53
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
|
|
54
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
55
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
56
|
+
Requires-Dist: ruff>=0.14.10; extra == 'dev'
|
|
57
|
+
Provides-Extra: docs
|
|
58
|
+
Requires-Dist: mkdocs-material~=9.0.0; extra == 'docs'
|
|
59
|
+
Requires-Dist: mkdocstrings[python]>=0.24.0; extra == 'docs'
|
|
60
|
+
Requires-Dist: mkdocs~=1.6.1; extra == 'docs'
|
|
61
|
+
Provides-Extra: full
|
|
62
|
+
Requires-Dist: aiofiles~=25.1.0; extra == 'full'
|
|
63
|
+
Requires-Dist: aiosqlite~=0.22.0; extra == 'full'
|
|
64
|
+
Requires-Dist: asyncmy~=0.2.10; extra == 'full'
|
|
65
|
+
Requires-Dist: asyncpg~=0.31.0; extra == 'full'
|
|
66
|
+
Requires-Dist: fastapi-cache2~=0.2.2; extra == 'full'
|
|
67
|
+
Requires-Dist: fastapi~=0.127.0; extra == 'full'
|
|
68
|
+
Requires-Dist: granian~=2.6.0; extra == 'full'
|
|
69
|
+
Requires-Dist: jinja2~=3.1.6; extra == 'full'
|
|
70
|
+
Requires-Dist: litellm~=1.75.0; extra == 'full'
|
|
71
|
+
Requires-Dist: nats-py~=2.10.0; extra == 'full'
|
|
72
|
+
Requires-Dist: orjson~=3.11.5; extra == 'full'
|
|
73
|
+
Requires-Dist: prometheus-client~=0.23.1; extra == 'full'
|
|
74
|
+
Requires-Dist: prometheus-fastapi-instrumentator~=7.1.0; extra == 'full'
|
|
75
|
+
Requires-Dist: python-multipart>=0.0.20; extra == 'full'
|
|
76
|
+
Requires-Dist: qdrant-client~=1.16.2; extra == 'full'
|
|
77
|
+
Requires-Dist: redis[hiredis]~=7.1.0; extra == 'full'
|
|
78
|
+
Requires-Dist: tortoise-orm~=0.25.2; extra == 'full'
|
|
79
|
+
Provides-Extra: full-pro
|
|
80
|
+
Requires-Dist: aiofiles~=25.1.0; extra == 'full-pro'
|
|
81
|
+
Requires-Dist: aiosqlite~=0.22.0; extra == 'full-pro'
|
|
82
|
+
Requires-Dist: alembic~=1.14.0; extra == 'full-pro'
|
|
83
|
+
Requires-Dist: asyncmy~=0.2.10; extra == 'full-pro'
|
|
84
|
+
Requires-Dist: asyncpg~=0.31.0; extra == 'full-pro'
|
|
85
|
+
Requires-Dist: fastapi-cache2~=0.2.2; extra == 'full-pro'
|
|
86
|
+
Requires-Dist: fastapi~=0.127.0; extra == 'full-pro'
|
|
87
|
+
Requires-Dist: granian~=2.6.0; extra == 'full-pro'
|
|
88
|
+
Requires-Dist: jinja2~=3.1.6; extra == 'full-pro'
|
|
89
|
+
Requires-Dist: litellm~=1.75.0; extra == 'full-pro'
|
|
90
|
+
Requires-Dist: nats-py~=2.10.0; extra == 'full-pro'
|
|
91
|
+
Requires-Dist: orjson~=3.11.5; extra == 'full-pro'
|
|
92
|
+
Requires-Dist: prometheus-client~=0.23.1; extra == 'full-pro'
|
|
93
|
+
Requires-Dist: prometheus-fastapi-instrumentator~=7.1.0; extra == 'full-pro'
|
|
94
|
+
Requires-Dist: python-multipart>=0.0.20; extra == 'full-pro'
|
|
95
|
+
Requires-Dist: qdrant-client~=1.16.2; extra == 'full-pro'
|
|
96
|
+
Requires-Dist: redis[hiredis]~=7.1.0; extra == 'full-pro'
|
|
97
|
+
Requires-Dist: sqlalchemy[asyncio]~=2.0.36; extra == 'full-pro'
|
|
98
|
+
Provides-Extra: llm
|
|
99
|
+
Requires-Dist: litellm~=1.75.0; extra == 'llm'
|
|
100
|
+
Provides-Extra: messaging
|
|
101
|
+
Requires-Dist: nats-py~=2.10.0; extra == 'messaging'
|
|
102
|
+
Provides-Extra: test
|
|
103
|
+
Requires-Dist: factory-boy>=3.3.0; extra == 'test'
|
|
104
|
+
Requires-Dist: httpx>=0.25.0; extra == 'test'
|
|
105
|
+
Requires-Dist: mypy>=1.8.0; extra == 'test'
|
|
106
|
+
Requires-Dist: pre-commit>=3.6.0; extra == 'test'
|
|
107
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'test'
|
|
108
|
+
Requires-Dist: pytest-benchmark>=4.0.0; extra == 'test'
|
|
109
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
|
|
110
|
+
Requires-Dist: pytest>=8.0.0; extra == 'test'
|
|
111
|
+
Requires-Dist: ruff>=0.14.10; extra == 'test'
|
|
112
|
+
Provides-Extra: vector
|
|
113
|
+
Requires-Dist: qdrant-client~=1.16.2; extra == 'vector'
|
|
114
|
+
Provides-Extra: web
|
|
115
|
+
Requires-Dist: aiofiles~=25.1.0; extra == 'web'
|
|
116
|
+
Requires-Dist: fastapi~=0.127.0; extra == 'web'
|
|
117
|
+
Requires-Dist: granian~=2.6.0; extra == 'web'
|
|
118
|
+
Requires-Dist: jinja2~=3.1.6; extra == 'web'
|
|
119
|
+
Requires-Dist: orjson~=3.11.5; extra == 'web'
|
|
120
|
+
Requires-Dist: prometheus-client~=0.23.1; extra == 'web'
|
|
121
|
+
Requires-Dist: prometheus-fastapi-instrumentator~=7.1.0; extra == 'web'
|
|
122
|
+
Requires-Dist: python-multipart>=0.0.20; extra == 'web'
|
|
123
|
+
Provides-Extra: web-basic
|
|
124
|
+
Requires-Dist: aiofiles~=25.1.0; extra == 'web-basic'
|
|
125
|
+
Requires-Dist: aiosqlite~=0.22.0; extra == 'web-basic'
|
|
126
|
+
Requires-Dist: asyncmy~=0.2.10; extra == 'web-basic'
|
|
127
|
+
Requires-Dist: asyncpg~=0.31.0; extra == 'web-basic'
|
|
128
|
+
Requires-Dist: fastapi~=0.127.0; extra == 'web-basic'
|
|
129
|
+
Requires-Dist: granian~=2.6.0; extra == 'web-basic'
|
|
130
|
+
Requires-Dist: jinja2~=3.1.6; extra == 'web-basic'
|
|
131
|
+
Requires-Dist: orjson~=3.11.5; extra == 'web-basic'
|
|
132
|
+
Requires-Dist: prometheus-client~=0.23.1; extra == 'web-basic'
|
|
133
|
+
Requires-Dist: prometheus-fastapi-instrumentator~=7.1.0; extra == 'web-basic'
|
|
134
|
+
Requires-Dist: python-multipart>=0.0.20; extra == 'web-basic'
|
|
135
|
+
Requires-Dist: tortoise-orm~=0.25.2; extra == 'web-basic'
|
|
136
|
+
Provides-Extra: web-cache
|
|
137
|
+
Requires-Dist: aiofiles~=25.1.0; extra == 'web-cache'
|
|
138
|
+
Requires-Dist: aiosqlite~=0.22.0; extra == 'web-cache'
|
|
139
|
+
Requires-Dist: asyncmy~=0.2.10; extra == 'web-cache'
|
|
140
|
+
Requires-Dist: asyncpg~=0.31.0; extra == 'web-cache'
|
|
141
|
+
Requires-Dist: fastapi-cache2~=0.2.2; extra == 'web-cache'
|
|
142
|
+
Requires-Dist: fastapi~=0.127.0; extra == 'web-cache'
|
|
143
|
+
Requires-Dist: granian~=2.6.0; extra == 'web-cache'
|
|
144
|
+
Requires-Dist: jinja2~=3.1.6; extra == 'web-cache'
|
|
145
|
+
Requires-Dist: orjson~=3.11.5; extra == 'web-cache'
|
|
146
|
+
Requires-Dist: prometheus-client~=0.23.1; extra == 'web-cache'
|
|
147
|
+
Requires-Dist: prometheus-fastapi-instrumentator~=7.1.0; extra == 'web-cache'
|
|
148
|
+
Requires-Dist: python-multipart>=0.0.20; extra == 'web-cache'
|
|
149
|
+
Requires-Dist: redis[hiredis]~=7.1.0; extra == 'web-cache'
|
|
150
|
+
Requires-Dist: tortoise-orm~=0.25.2; extra == 'web-cache'
|
|
151
|
+
Provides-Extra: web-full
|
|
152
|
+
Requires-Dist: aiofiles~=25.1.0; extra == 'web-full'
|
|
153
|
+
Requires-Dist: aiosqlite~=0.22.0; extra == 'web-full'
|
|
154
|
+
Requires-Dist: asyncmy~=0.2.10; extra == 'web-full'
|
|
155
|
+
Requires-Dist: asyncpg~=0.31.0; extra == 'web-full'
|
|
156
|
+
Requires-Dist: fastapi-cache2~=0.2.2; extra == 'web-full'
|
|
157
|
+
Requires-Dist: fastapi~=0.127.0; extra == 'web-full'
|
|
158
|
+
Requires-Dist: granian~=2.6.0; extra == 'web-full'
|
|
159
|
+
Requires-Dist: jinja2~=3.1.6; extra == 'web-full'
|
|
160
|
+
Requires-Dist: nats-py~=2.10.0; extra == 'web-full'
|
|
161
|
+
Requires-Dist: orjson~=3.11.5; extra == 'web-full'
|
|
162
|
+
Requires-Dist: prometheus-client~=0.23.1; extra == 'web-full'
|
|
163
|
+
Requires-Dist: prometheus-fastapi-instrumentator~=7.1.0; extra == 'web-full'
|
|
164
|
+
Requires-Dist: python-multipart>=0.0.20; extra == 'web-full'
|
|
165
|
+
Requires-Dist: qdrant-client~=1.16.2; extra == 'web-full'
|
|
166
|
+
Requires-Dist: redis[hiredis]~=7.1.0; extra == 'web-full'
|
|
167
|
+
Requires-Dist: tortoise-orm~=0.25.2; extra == 'web-full'
|
|
168
|
+
Provides-Extra: web-service
|
|
169
|
+
Requires-Dist: aiofiles~=25.1.0; extra == 'web-service'
|
|
170
|
+
Requires-Dist: aiosqlite~=0.22.0; extra == 'web-service'
|
|
171
|
+
Requires-Dist: asyncmy~=0.2.10; extra == 'web-service'
|
|
172
|
+
Requires-Dist: asyncpg~=0.31.0; extra == 'web-service'
|
|
173
|
+
Requires-Dist: fastapi-cache2~=0.2.2; extra == 'web-service'
|
|
174
|
+
Requires-Dist: fastapi~=0.127.0; extra == 'web-service'
|
|
175
|
+
Requires-Dist: granian~=2.6.0; extra == 'web-service'
|
|
176
|
+
Requires-Dist: jinja2~=3.1.6; extra == 'web-service'
|
|
177
|
+
Requires-Dist: orjson~=3.11.5; extra == 'web-service'
|
|
178
|
+
Requires-Dist: prometheus-client~=0.23.1; extra == 'web-service'
|
|
179
|
+
Requires-Dist: prometheus-fastapi-instrumentator~=7.1.0; extra == 'web-service'
|
|
180
|
+
Requires-Dist: python-multipart>=0.0.20; extra == 'web-service'
|
|
181
|
+
Requires-Dist: redis[hiredis]~=7.1.0; extra == 'web-service'
|
|
182
|
+
Requires-Dist: tortoise-orm~=0.25.2; extra == 'web-service'
|
|
183
|
+
Description-Content-Type: text/markdown
|
|
184
|
+
|
|
185
|
+
# infomankit
|
|
186
|
+
|
|
187
|
+
> 现代化 Python/AI 服务脚手架与工具箱。封装了配置加载、日志、FastAPI 服务、LLM 调用、缓存、消息队列、加解密等常用能力,帮助你快速把 idea 变成可部署的生产级服务。
|
|
188
|
+
|
|
189
|
+
## 特性亮点
|
|
190
|
+
- **统一配置体系**:`.env` + `config.py` 支持多环境加载,覆盖应用、数据库、缓存、LLM、MQ、向量库等关键参数。
|
|
191
|
+
- **FastAPI 微服务基线**:开箱即可运行的 `infoman.service.app`,内置 CORS、GZip、链路日志、中英文错误码、请求 ID、健康/监控接口。
|
|
192
|
+
- **灵活的 ORM 选择**:支持 `Tortoise ORM`(简单易用)和 `SQLAlchemy 2.0`(强大性能),可单独或同时使用。
|
|
193
|
+
- **异步基础设施**:MySQL/PostgreSQL、Redis 缓存、Litellm、NATS、Qdrant/Milvus 的集成入口,易于按需扩展。
|
|
194
|
+
- **AI/LLM 辅助**:`infoman.llm.LLM` 提供问答、对话、流式输出、翻译、总结、代码审查等常用封装。
|
|
195
|
+
- **性能测试工具**:内置标准化性能测试模块,支持定制化接口测试、精美 HTML 报告生成、多种接口类型评估标准。
|
|
196
|
+
- **实用工具集**:日志系统、缓存/重试/计时装饰器、AES/RSA、异步 HTTP、文本结构化提取、Feishu Bot 等常用基建。
|
|
197
|
+
- **细粒度模块化**:可单独安装 `web`、`database`、`database-alchemy`、`llm`、`vector`、`messaging` 等 extra,仅引入所需依赖。
|
|
198
|
+
|
|
199
|
+
## 目录速览
|
|
200
|
+
```
|
|
201
|
+
infoman/
|
|
202
|
+
├── config/ # 环境变量加载与全局配置
|
|
203
|
+
├── llm/ # Litellm 包装,提供 Chat/Stream/API
|
|
204
|
+
├── performance/ # 性能测试模块(新增)
|
|
205
|
+
│ ├── config.py # 测试配置管理
|
|
206
|
+
│ ├── runner.py # 测试运行器
|
|
207
|
+
│ ├── reporter.py # HTML 报告生成
|
|
208
|
+
│ ├── standards.py # 性能标准定义
|
|
209
|
+
│ └── cli.py # 命令行工具
|
|
210
|
+
├── service/
|
|
211
|
+
│ ├── app.py # FastAPI Application 入口
|
|
212
|
+
│ ├── routers/ # 健康检查与监控 API
|
|
213
|
+
│ ├── core/ # 事件、响应、认证
|
|
214
|
+
│ ├── infrastructure/ # 数据库,消息队列
|
|
215
|
+
│ ├── exception/ # 错误码、异常处理
|
|
216
|
+
│ ├── middleware/ # Logging、RequestID、RateLimit、中间件基类
|
|
217
|
+
│ ├── models/ # Tortoise 模型基类 & Embedding 配置
|
|
218
|
+
│ └── utils/ # redis 缓存装饰器、解析/转换
|
|
219
|
+
└── utils/
|
|
220
|
+
├── log/ # Loguru 配置与上下文
|
|
221
|
+
├── decorators/ # cache、retry、timing 等装饰器
|
|
222
|
+
├── encryption/ # AES/RSA/ECC
|
|
223
|
+
├── http/ # aiohttp 客户端、请求信息提取
|
|
224
|
+
├── notification/ # 飞书机器人通知
|
|
225
|
+
└── text/ # JSON 结构提取等
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## 快速开始
|
|
229
|
+
|
|
230
|
+
### 一键创建项目
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
# 安装 infomankit
|
|
234
|
+
pip install -U infomankit
|
|
235
|
+
|
|
236
|
+
# 创建新项目(自动生成标准目录结构)
|
|
237
|
+
infomancli init my-awesome-project
|
|
238
|
+
|
|
239
|
+
# 进入项目
|
|
240
|
+
cd my-awesome-project
|
|
241
|
+
|
|
242
|
+
# 安装依赖并运行
|
|
243
|
+
pip install -e .
|
|
244
|
+
cp .env.example .env
|
|
245
|
+
infoman-serve run main:app --reload
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
访问 http://localhost:8000 查看运行效果!
|
|
249
|
+
|
|
250
|
+
### 手动安装
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# Python >= 3.11
|
|
254
|
+
pip install -U infomankit
|
|
255
|
+
|
|
256
|
+
# 基础 Web 服务
|
|
257
|
+
pip install -U "infomankit[web]"
|
|
258
|
+
|
|
259
|
+
# 完整功能(使用 Tortoise ORM,100% 向前兼容)
|
|
260
|
+
pip install -U "infomankit[full]"
|
|
261
|
+
|
|
262
|
+
# 完整功能增强版(同时支持 Tortoise + SQLAlchemy)
|
|
263
|
+
pip install -U "infomankit[full-enhanced]"
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
常用 extra 组合:
|
|
267
|
+
|
|
268
|
+
| Extra | 说明 |
|
|
269
|
+
|----------------|--------------------------------|
|
|
270
|
+
| `web` | FastAPI/Granian/orjson |
|
|
271
|
+
| `database` | Tortoise ORM(默认) |
|
|
272
|
+
| `database-pro` | SQLAlchemy 2.0(高性能) |
|
|
273
|
+
| `cache` | Redis + fastapi-cache2 |
|
|
274
|
+
| `llm` | Litellm |
|
|
275
|
+
| `vector` | Qdrant |
|
|
276
|
+
| `messaging` | NATS |
|
|
277
|
+
| `full` | 完整功能(使用 Tortoise) |
|
|
278
|
+
| `full-pro` | 完整功能增强版(Tortoise + SQLAlchemy) |
|
|
279
|
+
|
|
280
|
+
本地开发推荐:
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
git clone https://github.com/yourusername/infoman-pykit.git
|
|
284
|
+
cd infomankit
|
|
285
|
+
pip install -e ".[dev,full]" # 安装所有依赖和 lint/test 工具
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## 快速上手
|
|
289
|
+
|
|
290
|
+
### 1. 配置环境变量
|
|
291
|
+
创建 `.env.dev`,并设置 `ENV=dev` (默认 dev)。可根据 `infoman/config/config.py` 填写常用变量:
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
APP_NAME=Infoman Service
|
|
295
|
+
APP_HOST=0.0.0.0
|
|
296
|
+
APP_PORT=8808
|
|
297
|
+
MYSQL_HOST=127.0.0.1
|
|
298
|
+
MYSQL_DB=infoman
|
|
299
|
+
MYSQL_USER=root
|
|
300
|
+
MYSQL_PASSWORD=secret
|
|
301
|
+
REDIS_HOST=127.0.0.1
|
|
302
|
+
QDRANT_HOST=127.0.0.1
|
|
303
|
+
LLM_PROXY=litellm_proxy
|
|
304
|
+
JWT_SECRET_KEY=change-me
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
运行时会依次加载 `.env` 与 `.env.{ENV}`,缺省值可在 `config.py` 中找到。
|
|
308
|
+
|
|
309
|
+
### 2. 启动 FastAPI 服务
|
|
310
|
+
```bash
|
|
311
|
+
export ENV=dev
|
|
312
|
+
uvicorn infoman.service.app:application --host ${APP_HOST:-0.0.0.0} --port ${APP_PORT:-8808} --reload
|
|
313
|
+
# or
|
|
314
|
+
python -m infoman.service.launch --mode gunicorn
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
应用启动后默认提供:
|
|
318
|
+
- `/api/health`:健康检查,返回 `{code:200}`。
|
|
319
|
+
- `/api/monitor`:进程 & 系统指标、环境信息。
|
|
320
|
+
- 启动事件中会自动注册 MySQL、Redis 缓存、NATS、Qdrant 等(根据配置是否填写)。
|
|
321
|
+
|
|
322
|
+
### 3. 调用 LLM
|
|
323
|
+
```python
|
|
324
|
+
import asyncio
|
|
325
|
+
from infoman.llm import LLM
|
|
326
|
+
|
|
327
|
+
async def main():
|
|
328
|
+
resp = await LLM.ask(
|
|
329
|
+
model="gpt-4o-mini",
|
|
330
|
+
prompt="请用一句话介绍 infoman-pykit。",
|
|
331
|
+
system_prompt="You are a concise assistant."
|
|
332
|
+
)
|
|
333
|
+
if resp.success:
|
|
334
|
+
print(resp.content, resp.total_tokens)
|
|
335
|
+
|
|
336
|
+
asyncio.run(main())
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
- `LLM.ask/chat/stream` 会自动补全 `LLM_PROXY` 前缀并返回 token 统计。
|
|
340
|
+
- `LLM.quick_*` 返回字符串,`LLM.translate/summarize/code_review` 内置常用 system prompt。
|
|
341
|
+
|
|
342
|
+
### 4. 使用 Redis 缓存装饰器
|
|
343
|
+
```python
|
|
344
|
+
from pydantic import BaseModel
|
|
345
|
+
from infoman.service.utils.cache import redis_cache
|
|
346
|
+
|
|
347
|
+
class ConfigSchema(BaseModel):
|
|
348
|
+
key: str
|
|
349
|
+
value: str
|
|
350
|
+
|
|
351
|
+
class ConfigService:
|
|
352
|
+
@redis_cache(prefix="config", ttl=600)
|
|
353
|
+
async def get_config(self, request, key: str) -> ConfigSchema:
|
|
354
|
+
# request.app.state.redis_client 将被装饰器自动读取
|
|
355
|
+
...
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
返回值可以是 `BaseModel`、`list[BaseModel]` 或普通 `dict`,装饰器会自动序列化/反序列化。
|
|
359
|
+
|
|
360
|
+
### 5. 消息队列与事件路由
|
|
361
|
+
|
|
362
|
+
```python
|
|
363
|
+
from infoman.service.infrastructure.mq.nats import event_router
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
@event_router.on("topic.user.created", queue="worker")
|
|
367
|
+
async def handle_user_created(msg, nats_cli):
|
|
368
|
+
payload = msg.data.decode()
|
|
369
|
+
...
|
|
370
|
+
|
|
371
|
+
# 启动时在 startup 事件中执行:
|
|
372
|
+
# await event_router.register(app.state.nats_client)
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
`NATSClient` 支持 `publish/request/subscribe/close`,并在 `events.startup` 中自动连接(配置 `NATS_SERVER` 后生效)。
|
|
376
|
+
|
|
377
|
+
## 日志与中间件
|
|
378
|
+
- `infoman.utils.log.logger` 基于 Loguru,自动创建多种文件(all/info/error/debug)并支持 JSON 日志、请求上下文(RequestID)。
|
|
379
|
+
- `LoggingMiddleware`:记录请求耗时、客户端信息;`RequestIDMiddleware` 为每次请求注入 `X-Request-ID`。
|
|
380
|
+
- `RateLimitMiddleware`:IP/用户/路径多策略限流,内存或 Redis 持久化。
|
|
381
|
+
- `BaseMiddleware` 为自定义中间件提供 session / 处理耗时写入示例。
|
|
382
|
+
|
|
383
|
+
## 统一错误与响应
|
|
384
|
+
- `infoman.service.exception.error` 定义系统、请求、数据库、业务、安全、外部服务等错误码枚举,可中英文提示。
|
|
385
|
+
- `AppException` + `handler.py` 将数据库、Pydantic、HTTP 异常统一转换为 `{code, message, details}`。
|
|
386
|
+
- `infoman.service.core.response.success/failed` 提供标准响应结构。
|
|
387
|
+
|
|
388
|
+
## 更多工具箱
|
|
389
|
+
- **装饰器**:`retry`(支持 async/sync 指数退避)、`cache`(内存缓存)、`timing`(执行耗时)。
|
|
390
|
+
- **加密**:AES(自动填充/随机 IV)、RSA(4096/自定义序列化)。
|
|
391
|
+
- **HTTP Client**:`HttpAsyncClient` 支持表单/JSON/文件上传,返回 `HttpResult`。
|
|
392
|
+
- **文本处理**:`utils.text.extractor.extract_json_from_string` 可从非结构化文本中提取 JSON。
|
|
393
|
+
- **通知**:`notification.feishu.RobotManager` 发送飞书机器人消息。
|
|
394
|
+
- **Embedding 配置**:`service.models.type.embed` 统一管理不同向量模型的维度/长度、集合命名。
|
|
395
|
+
|
|
396
|
+
## 配置清单速查
|
|
397
|
+
|
|
398
|
+
| 分类 | 重点变量 |
|
|
399
|
+
|--------------|----------|
|
|
400
|
+
| 应用 | `APP_NAME`, `APP_HOST`, `APP_PORT`, `APP_BASE_URI`, `APP_DEBUG` |
|
|
401
|
+
| 安全 | `JWT_SECRET_KEY`, `JWT_ALGORITHM`, `JWT_ACCESS_TOKEN_EXPIRE_MINUTES`, `OAUTH2_REDIRECT_URL` |
|
|
402
|
+
| 数据库 | `MYSQL_HOST`, `MYSQL_PORT`, `MYSQL_DB`, `MYSQL_USER`, `MYSQL_PASSWORD`, `MYSQL_TABLE_MODELS` |
|
|
403
|
+
| 缓存 / Redis | `REDIS_HOST`, `REDIS_PORT`, `REDIS_DB`, `REDIS_PASSWORD` |
|
|
404
|
+
| 向量数据库 | `QDRANT_HOST`/`API_KEY`/`HTTP_PORT`/`GRPC_PORT`、`MILVUS_HOST` 等(Milvus 需实现 `AsyncMilvusClient`) |
|
|
405
|
+
| MQ | `NATS_SERVER`(逗号分隔多实例), `NATS_NAME` |
|
|
406
|
+
| LLM | `LLM_PROXY`(litellm 代理地址) |
|
|
407
|
+
| 日志 | `LOG_LEVEL`, `LOG_FORMAT`, `LOG_DIR`, `LOG_RETENTION`, `LOG_ENABLE_*` |
|
|
408
|
+
|
|
409
|
+
## 开发 & 测试
|
|
410
|
+
```bash
|
|
411
|
+
# Lint / 格式化
|
|
412
|
+
ruff check infoman
|
|
413
|
+
black infoman
|
|
414
|
+
isort infoman
|
|
415
|
+
|
|
416
|
+
# 类型检查
|
|
417
|
+
mypy infoman
|
|
418
|
+
|
|
419
|
+
# 测试
|
|
420
|
+
pytest
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
## 🔀 ORM 选择指南
|
|
424
|
+
|
|
425
|
+
从 v0.3.0 开始,infomankit 支持两种 ORM:
|
|
426
|
+
|
|
427
|
+
### Tortoise ORM(默认)
|
|
428
|
+
**适合**:简单 CRUD、快速开发、学习成本低
|
|
429
|
+
```python
|
|
430
|
+
from infoman.service.models.base import TimestampMixin
|
|
431
|
+
from tortoise import fields
|
|
432
|
+
|
|
433
|
+
class User(TimestampMixin):
|
|
434
|
+
name = fields.CharField(max_length=100)
|
|
435
|
+
|
|
436
|
+
# 直接使用
|
|
437
|
+
user = await User.create(name="Alice")
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### SQLAlchemy 2.0(高性能)
|
|
441
|
+
**适合**:复杂查询、高性能需求、工业级项目
|
|
442
|
+
```python
|
|
443
|
+
from infoman.service.models.base import AlchemyBase, AlchemyTimestampMixin
|
|
444
|
+
from sqlalchemy import String
|
|
445
|
+
from sqlalchemy.orm import Mapped, mapped_column
|
|
446
|
+
|
|
447
|
+
class User(AlchemyBase, AlchemyTimestampMixin):
|
|
448
|
+
__tablename__ = "users"
|
|
449
|
+
name: Mapped[str] = mapped_column(String(100))
|
|
450
|
+
|
|
451
|
+
# 使用仓储模式
|
|
452
|
+
from infoman.service.models.base import create_repository
|
|
453
|
+
user_repo = create_repository(User)
|
|
454
|
+
user = await user_repo.create(name="Alice")
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
**详细迁移指南**: 👉 [doc/MIGRATION_TO_SQLALCHEMY.md](./doc/MIGRATION_TO_SQLALCHEMY.md)
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
## 📊 性能测试模块
|
|
462
|
+
|
|
463
|
+
infomankit 内置了标准化的性能测试工具,支持定制化接口测试和精美的 HTML 报告生成。
|
|
464
|
+
|
|
465
|
+
### 核心特性
|
|
466
|
+
|
|
467
|
+
- **标准化评估**:内置 4 种接口类型(fast/normal/complex/heavy)的性能标准
|
|
468
|
+
- **定制化配置**:支持 YAML 配置文件,灵活定义测试用例
|
|
469
|
+
- **高并发测试**:基于 asyncio 的异步并发执行
|
|
470
|
+
- **详细统计**:P50/P95/P99 响应时间、吞吐量、成功率等指标
|
|
471
|
+
- **精美报告**:自动生成响应式 HTML 报告,色彩分级展示
|
|
472
|
+
- **认证支持**:Bearer Token、Basic Auth 等多种认证方式
|
|
473
|
+
|
|
474
|
+
### 快速开始
|
|
475
|
+
|
|
476
|
+
#### 1. 创建配置文件
|
|
477
|
+
|
|
478
|
+
```yaml
|
|
479
|
+
# performance-test.yaml
|
|
480
|
+
project_name: "My API"
|
|
481
|
+
base_url: "http://localhost:8000"
|
|
482
|
+
|
|
483
|
+
# 并发配置
|
|
484
|
+
concurrent_users: 50
|
|
485
|
+
duration: 60 # 秒
|
|
486
|
+
|
|
487
|
+
# 测试用例
|
|
488
|
+
test_cases:
|
|
489
|
+
- name: "健康检查"
|
|
490
|
+
url: "/api/health"
|
|
491
|
+
method: "GET"
|
|
492
|
+
interface_type: "fast"
|
|
493
|
+
|
|
494
|
+
- name: "用户列表"
|
|
495
|
+
url: "/api/v1/users"
|
|
496
|
+
method: "GET"
|
|
497
|
+
interface_type: "normal"
|
|
498
|
+
params:
|
|
499
|
+
page: 1
|
|
500
|
+
page_size: 20
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
#### 2. 运行测试
|
|
504
|
+
|
|
505
|
+
```bash
|
|
506
|
+
# 使用 Python 代码
|
|
507
|
+
python -c "
|
|
508
|
+
import asyncio
|
|
509
|
+
from infoman.performance import TestConfig, PerformanceTestRunner, HTMLReporter
|
|
510
|
+
|
|
511
|
+
async def test():
|
|
512
|
+
config = TestConfig.from_yaml('performance-test.yaml')
|
|
513
|
+
runner = PerformanceTestRunner(config)
|
|
514
|
+
results = await runner.run()
|
|
515
|
+
|
|
516
|
+
reporter = HTMLReporter(config)
|
|
517
|
+
reporter.generate(results)
|
|
518
|
+
|
|
519
|
+
asyncio.run(test())
|
|
520
|
+
"
|
|
521
|
+
|
|
522
|
+
# 或使用 Makefile
|
|
523
|
+
make perf-test
|
|
524
|
+
make perf-test-api
|
|
525
|
+
make perf-test-stress
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
#### 3. 查看报告
|
|
529
|
+
|
|
530
|
+
测试完成后会生成精美的 HTML 报告,包含:
|
|
531
|
+
- 汇总指标(总请求数、成功率、平均响应时间、吞吐量)
|
|
532
|
+
- 每个接口的详细统计
|
|
533
|
+
- 响应时间百分位(P50/P95/P99)
|
|
534
|
+
- 性能评级和优化建议
|
|
535
|
+
- 错误信息汇总
|
|
536
|
+
|
|
537
|
+
### 性能标准
|
|
538
|
+
|
|
539
|
+
模块内置 4 种接口类型的标准:
|
|
540
|
+
|
|
541
|
+
| 接口类型 | 优秀 | 良好 | 可接受 | 较差 |
|
|
542
|
+
|---------|------|------|--------|------|
|
|
543
|
+
| **快速接口** (fast) | <10ms | <30ms | <50ms | <100ms |
|
|
544
|
+
| **一般接口** (normal) | <50ms | <100ms | <200ms | <500ms |
|
|
545
|
+
| **复杂接口** (complex) | <100ms | <200ms | <500ms | <1s |
|
|
546
|
+
| **重型接口** (heavy) | <200ms | <500ms | <1s | <3s |
|
|
547
|
+
|
|
548
|
+
### 更多文档
|
|
549
|
+
|
|
550
|
+
- 完整文档:[infoman/performance/README.md](./infoman/performance/README.md)
|
|
551
|
+
- 配置示例:[examples/performance/](./examples/performance/)
|
|
552
|
+
- 高级用法:[examples/performance/advanced_example.py](./examples/performance/advanced_example.py)
|
|
553
|
+
|
|
554
|
+
---
|
|
555
|
+
|
|
556
|
+
## 🛠️ CLI 脚手架工具
|
|
557
|
+
|
|
558
|
+
infomankit 提供了 `infomancli` 命令行工具,帮助你快速生成标准化的项目结构。
|
|
559
|
+
|
|
560
|
+
### 基本用法
|
|
561
|
+
|
|
562
|
+
```bash
|
|
563
|
+
# 交互式创建项目
|
|
564
|
+
infomancli init
|
|
565
|
+
|
|
566
|
+
# 直接指定项目名
|
|
567
|
+
infomancli init my-project
|
|
568
|
+
|
|
569
|
+
# 在指定目录创建
|
|
570
|
+
infomancli init my-project --dir /path/to/workspace
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
### 生成的项目结构
|
|
574
|
+
|
|
575
|
+
生成的项目遵循 `infoman/service` 的标准架构:
|
|
576
|
+
|
|
577
|
+
```
|
|
578
|
+
my-project/
|
|
579
|
+
├── .env.example # 环境变量模板
|
|
580
|
+
├── .gitignore
|
|
581
|
+
├── README.md
|
|
582
|
+
├── main.py # FastAPI 应用入口
|
|
583
|
+
├── pyproject.toml
|
|
584
|
+
│
|
|
585
|
+
├── core/ # 核心业务逻辑
|
|
586
|
+
│ ├── auth.py # 认证授权
|
|
587
|
+
│ └── response.py # 标准响应模型
|
|
588
|
+
├── routers/ # API 路由
|
|
589
|
+
├── models/ # 数据模型
|
|
590
|
+
│ ├── entity/ # 数据库实体 (ORM)
|
|
591
|
+
│ ├── dto/ # 数据传输对象
|
|
592
|
+
│ └── schemas/ # Pydantic 验证模式
|
|
593
|
+
├── repository/ # 数据访问层
|
|
594
|
+
├── services/ # 业务逻辑服务
|
|
595
|
+
├── exception/ # 自定义异常
|
|
596
|
+
├── middleware/ # 自定义中间件
|
|
597
|
+
├── infrastructure/ # 基础设施
|
|
598
|
+
│ ├── database/ # 数据库连接
|
|
599
|
+
│ └── cache/ # 缓存管理
|
|
600
|
+
└── utils/ # 工具函数
|
|
601
|
+
├── cache/
|
|
602
|
+
└── parse/
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
### 快速体验
|
|
606
|
+
|
|
607
|
+
```bash
|
|
608
|
+
# 1. 创建项目
|
|
609
|
+
infomancli init demo-api
|
|
610
|
+
|
|
611
|
+
# 2. 进入并安装
|
|
612
|
+
cd demo-api
|
|
613
|
+
pip install -e .
|
|
614
|
+
|
|
615
|
+
# 3. 启动服务
|
|
616
|
+
cp .env.example .env
|
|
617
|
+
infoman-serve run main:app --reload
|
|
618
|
+
|
|
619
|
+
# 4. 访问 API 文档
|
|
620
|
+
open http://localhost:8000/docs
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
生成的项目包含:
|
|
624
|
+
- ✅ 完整的项目结构
|
|
625
|
+
- ✅ FastAPI 应用框架
|
|
626
|
+
- ✅ 环境变量配置
|
|
627
|
+
- ✅ 健康检查端点
|
|
628
|
+
- ✅ Git 配置
|
|
629
|
+
- ✅ 开发文档
|
|
630
|
+
|
|
631
|
+
## License
|
|
632
|
+
MIT License © Infoman Contributors
|