infomankit 0.3.4__tar.gz → 0.3.9__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.
- {infomankit-0.3.4 → infomankit-0.3.9}/PKG-INFO +33 -25
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/config/base.py +14 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/config/db_relation.py +1 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/app.py +19 -26
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/core/lifespan.py +8 -3
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/db_relation/__init__.py +0 -17
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/db_relation/manager.py +0 -10
- infomankit-0.3.9/infoman/service/infrastructure/db_relation/manager_pro.py +408 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/pyproject.toml +7 -5
- infomankit-0.3.4/infoman/service/infrastructure/db_relation/manager_hybrid.py +0 -579
- {infomankit-0.3.4 → infomankit-0.3.9}/.gitignore +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/README.md +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/doc/changelog/README.md +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/examples/README.md +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/cli/README.md +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/cli/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/cli/commands/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/cli/commands/init.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/cli/scaffold.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/config/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/config/db_cache.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/config/db_vector.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/config/jwt.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/config/llm.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/config/log.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/config/mq.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/config/settings.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/llm/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/llm/llm.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/logger/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/logger/context.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/logger/core.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/logger/filters.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/logger/formatters.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/logger/handlers.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/logger/metrics.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/core/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/core/auth.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/core/monitor.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/core/response.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/exception/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/exception/error.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/exception/exception.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/exception/handler.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/base.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/db_cache/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/db_cache/manager.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/db_relation/mysql.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/db_relation/pgsql.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/db_relation/sqllite.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/db_vector/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/db_vector/manager.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/db_vector/qdrant.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/mq/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/mq/manager.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/mq/nats/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/mq/nats/nats_client.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/mq/nats/nats_event_router.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/launch.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/middleware/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/middleware/base.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/middleware/logging.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/middleware/rate_limit.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/middleware/request_id.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/middleware/white_list.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/models/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/models/base.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/models/type/embed.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/routers/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/routers/health_router.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/routers/monitor_router.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/utils/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/utils/cache/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/utils/cache/cache.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/utils/module_loader.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/utils/parse.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/utils/resolver/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/utils/resolver/base.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/utils/resolver/resp.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/vector/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/vector/base.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/vector/qdrant.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/vector/service.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/decorators/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/decorators/cache.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/decorators/retry.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/decorators/safe_execute.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/decorators/timing.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/encryption/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/encryption/aes.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/encryption/ecc.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/encryption/rsa.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/file/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/file/handler.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/hash/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/hash/hash.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/http/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/http/client.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/http/info.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/http/result.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/notification/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/notification/feishu.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/text/__init__.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/infoman/utils/text/extractor.py +0 -0
- {infomankit-0.3.4 → infomankit-0.3.9}/tests/README.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: infomankit
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.9
|
|
4
4
|
Summary: Infoman base library - A comprehensive toolkit for modern Python applications with dual ORM support
|
|
5
5
|
Project-URL: Homepage, https://github.com/infoman-lib/infoman-pykit
|
|
6
6
|
Project-URL: Documentation, https://github.com/infoman-lib/infoman-pykit
|
|
@@ -43,12 +43,6 @@ Requires-Dist: aiosqlite~=0.22.0; extra == 'database'
|
|
|
43
43
|
Requires-Dist: asyncmy~=0.2.10; extra == 'database'
|
|
44
44
|
Requires-Dist: asyncpg~=0.31.0; extra == 'database'
|
|
45
45
|
Requires-Dist: tortoise-orm~=0.25.2; extra == 'database'
|
|
46
|
-
Provides-Extra: database-alchemy
|
|
47
|
-
Requires-Dist: aiosqlite~=0.22.0; extra == 'database-alchemy'
|
|
48
|
-
Requires-Dist: alembic~=1.14.0; extra == 'database-alchemy'
|
|
49
|
-
Requires-Dist: asyncmy~=0.2.10; extra == 'database-alchemy'
|
|
50
|
-
Requires-Dist: asyncpg~=0.31.0; extra == 'database-alchemy'
|
|
51
|
-
Requires-Dist: sqlalchemy[asyncio]~=2.0.36; extra == 'database-alchemy'
|
|
52
46
|
Provides-Extra: database-full
|
|
53
47
|
Requires-Dist: aiosqlite~=0.22.0; extra == 'database-full'
|
|
54
48
|
Requires-Dist: alembic~=1.14.0; extra == 'database-full'
|
|
@@ -56,6 +50,12 @@ Requires-Dist: asyncmy~=0.2.10; extra == 'database-full'
|
|
|
56
50
|
Requires-Dist: asyncpg~=0.31.0; extra == 'database-full'
|
|
57
51
|
Requires-Dist: sqlalchemy[asyncio]~=2.0.36; extra == 'database-full'
|
|
58
52
|
Requires-Dist: tortoise-orm~=0.25.2; extra == 'database-full'
|
|
53
|
+
Provides-Extra: database-pro
|
|
54
|
+
Requires-Dist: aiosqlite~=0.22.0; extra == 'database-pro'
|
|
55
|
+
Requires-Dist: alembic~=1.14.0; extra == 'database-pro'
|
|
56
|
+
Requires-Dist: asyncmy~=0.2.10; extra == 'database-pro'
|
|
57
|
+
Requires-Dist: asyncpg~=0.31.0; extra == 'database-pro'
|
|
58
|
+
Requires-Dist: sqlalchemy[asyncio]~=2.0.36; extra == 'database-pro'
|
|
59
59
|
Provides-Extra: datakit
|
|
60
60
|
Requires-Dist: aiosqlite~=0.22.0; extra == 'datakit'
|
|
61
61
|
Requires-Dist: asyncmy~=0.2.10; extra == 'datakit'
|
|
@@ -83,32 +83,36 @@ Requires-Dist: asyncpg~=0.31.0; extra == 'full'
|
|
|
83
83
|
Requires-Dist: fastapi-cache2~=0.2.2; extra == 'full'
|
|
84
84
|
Requires-Dist: fastapi~=0.127.0; extra == 'full'
|
|
85
85
|
Requires-Dist: granian~=2.6.0; extra == 'full'
|
|
86
|
+
Requires-Dist: jinja2~=3.1.6; extra == 'full'
|
|
86
87
|
Requires-Dist: litellm~=1.75.0; extra == 'full'
|
|
87
88
|
Requires-Dist: nats-py~=2.10.0; extra == 'full'
|
|
88
89
|
Requires-Dist: orjson~=3.11.5; extra == 'full'
|
|
89
90
|
Requires-Dist: prometheus-client~=0.23.1; extra == 'full'
|
|
90
91
|
Requires-Dist: prometheus-fastapi-instrumentator~=7.1.0; extra == 'full'
|
|
92
|
+
Requires-Dist: python-multipart>=0.0.20; extra == 'full'
|
|
91
93
|
Requires-Dist: qdrant-client~=1.16.2; extra == 'full'
|
|
92
94
|
Requires-Dist: redis[hiredis]~=7.1.0; extra == 'full'
|
|
93
95
|
Requires-Dist: tortoise-orm~=0.25.2; extra == 'full'
|
|
94
|
-
Provides-Extra: full-
|
|
95
|
-
Requires-Dist: aiofiles~=25.1.0; extra == 'full-
|
|
96
|
-
Requires-Dist: aiosqlite~=0.22.0; extra == 'full-
|
|
97
|
-
Requires-Dist: alembic~=1.14.0; extra == 'full-
|
|
98
|
-
Requires-Dist: asyncmy~=0.2.10; extra == 'full-
|
|
99
|
-
Requires-Dist: asyncpg~=0.31.0; extra == 'full-
|
|
100
|
-
Requires-Dist: fastapi-cache2~=0.2.2; extra == 'full-
|
|
101
|
-
Requires-Dist: fastapi~=0.127.0; extra == 'full-
|
|
102
|
-
Requires-Dist: granian~=2.6.0; extra == 'full-
|
|
103
|
-
Requires-Dist:
|
|
104
|
-
Requires-Dist:
|
|
105
|
-
Requires-Dist:
|
|
106
|
-
Requires-Dist:
|
|
107
|
-
Requires-Dist: prometheus-
|
|
108
|
-
Requires-Dist:
|
|
109
|
-
Requires-Dist:
|
|
110
|
-
Requires-Dist:
|
|
111
|
-
Requires-Dist:
|
|
96
|
+
Provides-Extra: full-pro
|
|
97
|
+
Requires-Dist: aiofiles~=25.1.0; extra == 'full-pro'
|
|
98
|
+
Requires-Dist: aiosqlite~=0.22.0; extra == 'full-pro'
|
|
99
|
+
Requires-Dist: alembic~=1.14.0; extra == 'full-pro'
|
|
100
|
+
Requires-Dist: asyncmy~=0.2.10; extra == 'full-pro'
|
|
101
|
+
Requires-Dist: asyncpg~=0.31.0; extra == 'full-pro'
|
|
102
|
+
Requires-Dist: fastapi-cache2~=0.2.2; extra == 'full-pro'
|
|
103
|
+
Requires-Dist: fastapi~=0.127.0; extra == 'full-pro'
|
|
104
|
+
Requires-Dist: granian~=2.6.0; extra == 'full-pro'
|
|
105
|
+
Requires-Dist: jinja2~=3.1.6; extra == 'full-pro'
|
|
106
|
+
Requires-Dist: litellm~=1.75.0; extra == 'full-pro'
|
|
107
|
+
Requires-Dist: nats-py~=2.10.0; extra == 'full-pro'
|
|
108
|
+
Requires-Dist: orjson~=3.11.5; extra == 'full-pro'
|
|
109
|
+
Requires-Dist: prometheus-client~=0.23.1; extra == 'full-pro'
|
|
110
|
+
Requires-Dist: prometheus-fastapi-instrumentator~=7.1.0; extra == 'full-pro'
|
|
111
|
+
Requires-Dist: python-multipart>=0.0.20; extra == 'full-pro'
|
|
112
|
+
Requires-Dist: qdrant-client~=1.16.2; extra == 'full-pro'
|
|
113
|
+
Requires-Dist: redis[hiredis]~=7.1.0; extra == 'full-pro'
|
|
114
|
+
Requires-Dist: sqlalchemy[asyncio]~=2.0.36; extra == 'full-pro'
|
|
115
|
+
Requires-Dist: tortoise-orm~=0.25.2; extra == 'full-pro'
|
|
112
116
|
Provides-Extra: llm
|
|
113
117
|
Requires-Dist: litellm~=1.75.0; extra == 'llm'
|
|
114
118
|
Provides-Extra: messaging
|
|
@@ -129,17 +133,21 @@ Provides-Extra: web
|
|
|
129
133
|
Requires-Dist: aiofiles~=25.1.0; extra == 'web'
|
|
130
134
|
Requires-Dist: fastapi~=0.127.0; extra == 'web'
|
|
131
135
|
Requires-Dist: granian~=2.6.0; extra == 'web'
|
|
136
|
+
Requires-Dist: jinja2~=3.1.6; extra == 'web'
|
|
132
137
|
Requires-Dist: orjson~=3.11.5; extra == 'web'
|
|
133
138
|
Requires-Dist: prometheus-client~=0.23.1; extra == 'web'
|
|
134
139
|
Requires-Dist: prometheus-fastapi-instrumentator~=7.1.0; extra == 'web'
|
|
140
|
+
Requires-Dist: python-multipart>=0.0.20; extra == 'web'
|
|
135
141
|
Provides-Extra: webapp
|
|
136
142
|
Requires-Dist: aiofiles~=25.1.0; extra == 'webapp'
|
|
137
143
|
Requires-Dist: fastapi-cache2~=0.2.2; extra == 'webapp'
|
|
138
144
|
Requires-Dist: fastapi~=0.127.0; extra == 'webapp'
|
|
139
145
|
Requires-Dist: granian~=2.6.0; extra == 'webapp'
|
|
146
|
+
Requires-Dist: jinja2~=3.1.6; extra == 'webapp'
|
|
140
147
|
Requires-Dist: orjson~=3.11.5; extra == 'webapp'
|
|
141
148
|
Requires-Dist: prometheus-client~=0.23.1; extra == 'webapp'
|
|
142
149
|
Requires-Dist: prometheus-fastapi-instrumentator~=7.1.0; extra == 'webapp'
|
|
150
|
+
Requires-Dist: python-multipart>=0.0.20; extra == 'webapp'
|
|
143
151
|
Requires-Dist: redis[hiredis]~=7.1.0; extra == 'webapp'
|
|
144
152
|
Description-Content-Type: text/markdown
|
|
145
153
|
|
|
@@ -24,6 +24,8 @@ class BaseConfig(BaseSettings):
|
|
|
24
24
|
APP_PORT: int = Field(default=8000)
|
|
25
25
|
APP_DESCRIPTION: str = Field(default="Information System")
|
|
26
26
|
|
|
27
|
+
DEFAULT_LANGUAGE_IS_EN: bool = Field(default=True)
|
|
28
|
+
|
|
27
29
|
# ========== 服务器配置 ==========
|
|
28
30
|
APP_WORKERS: int = Field(default=2, description="工作进程数(Granian/Gunicorn)")
|
|
29
31
|
APP_THREADS: int = Field(default=1, description="每个 worker 的线程数(Granian)")
|
|
@@ -37,6 +39,18 @@ class BaseConfig(BaseSettings):
|
|
|
37
39
|
ALLOW_CREDENTIALS: bool = Field(default=False)
|
|
38
40
|
ALLOW_METHODS: list[str] = Field(default=["GET", "POST"])
|
|
39
41
|
ALLOW_HEADERS: list[str] = Field(default=["Content-Type", "Authorization", "X-Request-ID"])
|
|
42
|
+
MAX_AGE: int = Field(default=600)
|
|
43
|
+
|
|
44
|
+
# ========== Router配置 ==========
|
|
45
|
+
USE_DEFAULT_ROUTER: bool = Field(default=False)
|
|
46
|
+
USE_PROMETHEUS_ROUTER: bool = Field(default=False)
|
|
47
|
+
USE_STATIC: bool = Field(default=False)
|
|
48
|
+
STATIC_NAME: str = Field(default="static")
|
|
49
|
+
STATIC_DIR: str = Field(default="app/static")
|
|
50
|
+
STATIC_URL: str = Field(default="/static")
|
|
51
|
+
USE_TEMPLATES: bool = Field(default=False)
|
|
52
|
+
TEMPLATE_ROUTER_URL: str = Field(default="/app/template")
|
|
53
|
+
|
|
40
54
|
|
|
41
55
|
@property
|
|
42
56
|
def is_dev(self) -> bool:
|
|
@@ -46,6 +46,7 @@ class DatabaseInstanceConfig(BaseSettings):
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
class DatabaseConfig(BaseSettings):
|
|
49
|
+
USE_PRO_ORM: bool = Field(default=False)
|
|
49
50
|
# ========== MySQL ==========
|
|
50
51
|
MYSQL_ENABLED: bool = Field(default=False)
|
|
51
52
|
MYSQL_HOST: Optional[str] = Field(default=None)
|
|
@@ -1,29 +1,6 @@
|
|
|
1
1
|
# !/usr/bin/env python
|
|
2
2
|
# -*-coding:utf-8 -*-
|
|
3
3
|
|
|
4
|
-
"""
|
|
5
|
-
FastAPI 应用实例(可扩展)
|
|
6
|
-
|
|
7
|
-
用法:
|
|
8
|
-
# 方式 1: 直接使用(内置路由)
|
|
9
|
-
from infoman.service.app import application
|
|
10
|
-
|
|
11
|
-
# 方式 2: 扩展应用(添加自己的路由)
|
|
12
|
-
from infoman.service.app import application
|
|
13
|
-
from fastapi import APIRouter
|
|
14
|
-
|
|
15
|
-
router = APIRouter()
|
|
16
|
-
|
|
17
|
-
@router.get("/my-endpoint")
|
|
18
|
-
def my_endpoint():
|
|
19
|
-
return {"message": "My custom endpoint"}
|
|
20
|
-
|
|
21
|
-
application.include_router(router, prefix="/api", tags=["custom"])
|
|
22
|
-
|
|
23
|
-
# 方式 3: 启动应用
|
|
24
|
-
# infoman-serve # 使用内置应用
|
|
25
|
-
"""
|
|
26
|
-
|
|
27
4
|
from infoman.config.settings import settings
|
|
28
5
|
from infoman.logger import setup_logger
|
|
29
6
|
from fastapi import FastAPI
|
|
@@ -62,13 +39,29 @@ application.add_middleware(
|
|
|
62
39
|
allow_credentials=config.ALLOW_CREDENTIALS,
|
|
63
40
|
allow_methods=config.ALLOW_METHODS,
|
|
64
41
|
allow_headers=config.ALLOW_HEADERS,
|
|
65
|
-
max_age=
|
|
42
|
+
max_age=config.MAX_AGE,
|
|
66
43
|
)
|
|
67
44
|
application.add_middleware(RequestIDMiddleware)
|
|
68
45
|
application.add_middleware(LoggingMiddleware)
|
|
69
46
|
|
|
70
47
|
# ============ 内置路由(可选,用户可以选择不使用) ============
|
|
71
|
-
|
|
48
|
+
if config.USE_DEFAULT_ROUTER:
|
|
49
|
+
application.include_router(api_router)
|
|
50
|
+
|
|
51
|
+
if config.USE_TEMPLATES:
|
|
52
|
+
from fastapi.templating import Jinja2Templates
|
|
53
|
+
application.state.templates = Jinja2Templates(directory="app/static")
|
|
54
|
+
|
|
55
|
+
if config.USE_STATIC:
|
|
56
|
+
from fastapi.staticfiles import StaticFiles
|
|
57
|
+
application.mount(
|
|
58
|
+
path=config.STATIC_URL,
|
|
59
|
+
app=StaticFiles(directory=config.STATIC_DIR),
|
|
60
|
+
name=config.STATIC_NAME
|
|
61
|
+
)
|
|
72
62
|
|
|
73
63
|
# ============ Prometheus 监控 ============
|
|
74
|
-
|
|
64
|
+
if config.USE_PROMETHEUS_ROUTER:
|
|
65
|
+
instrumentator.instrument(application).expose(application, endpoint="/metrics")
|
|
66
|
+
|
|
67
|
+
|
|
@@ -13,8 +13,13 @@ from loguru import logger
|
|
|
13
13
|
|
|
14
14
|
from infoman.config import settings
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
from infoman.service.infrastructure.db_relation.
|
|
16
|
+
if settings.USE_PRO_ORM:
|
|
17
|
+
from infoman.service.infrastructure.db_relation.manager_pro import db_manager
|
|
18
|
+
_DB_MANAGER_TYPE = "pro"
|
|
19
|
+
else:
|
|
20
|
+
from infoman.service.infrastructure.db_relation.manager import db_manager
|
|
21
|
+
_DB_MANAGER_TYPE = "basic"
|
|
22
|
+
|
|
18
23
|
from infoman.service.infrastructure.db_cache.manager import RedisManager
|
|
19
24
|
from infoman.service.infrastructure.db_vector.manager import VectorDBManager
|
|
20
25
|
from infoman.service.infrastructure.mq import NATSManager
|
|
@@ -27,9 +32,9 @@ async def lifespan(app: FastAPI):
|
|
|
27
32
|
# ========== 启动 ==========
|
|
28
33
|
logger.info(f"🚀 应用启动中 [{settings.APP_NAME} v{settings.APP_VERSION}]")
|
|
29
34
|
logger.info(f" 环境: {settings.ENV}")
|
|
35
|
+
logger.info(f" 数据库管理器: {_DB_MANAGER_TYPE}")
|
|
30
36
|
|
|
31
37
|
# 初始化管理器
|
|
32
|
-
db_manager = DatabaseManager()
|
|
33
38
|
redis_manager = RedisManager()
|
|
34
39
|
vector_manager = VectorDBManager()
|
|
35
40
|
nats_manager = NATSManager()
|
{infomankit-0.3.4 → infomankit-0.3.9}/infoman/service/infrastructure/db_relation/__init__.py
RENAMED
|
@@ -19,16 +19,6 @@ from infoman.service.infrastructure.db_relation.manager import (
|
|
|
19
19
|
get_connection_names as get_connection_names_tortoise,
|
|
20
20
|
)
|
|
21
21
|
|
|
22
|
-
# ==================== 新增:混合管理器 ====================
|
|
23
|
-
|
|
24
|
-
from infoman.service.infrastructure.db_relation.manager_hybrid import (
|
|
25
|
-
HybridDatabaseManager,
|
|
26
|
-
hybrid_db_manager,
|
|
27
|
-
register_databases as register_databases_hybrid,
|
|
28
|
-
check_databases_health as check_databases_health_hybrid,
|
|
29
|
-
close_databases as close_databases_hybrid,
|
|
30
|
-
get_connection_names as get_connection_names_hybrid,
|
|
31
|
-
)
|
|
32
22
|
|
|
33
23
|
# ==================== 默认导出(向前兼容)====================
|
|
34
24
|
|
|
@@ -42,13 +32,6 @@ __all__ = [
|
|
|
42
32
|
"close_databases",
|
|
43
33
|
"get_connection_names",
|
|
44
34
|
|
|
45
|
-
# 混合管理器(新增)
|
|
46
|
-
"HybridDatabaseManager",
|
|
47
|
-
"hybrid_db_manager",
|
|
48
|
-
"register_databases_hybrid",
|
|
49
|
-
"check_databases_health_hybrid",
|
|
50
|
-
"close_databases_hybrid",
|
|
51
|
-
"get_connection_names_hybrid",
|
|
52
35
|
]
|
|
53
36
|
|
|
54
37
|
# 默认导出指向 Tortoise 版本(向前兼容)
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
from typing import Dict, Optional, List, Any
|
|
13
13
|
from fastapi import FastAPI
|
|
14
14
|
from tortoise import Tortoise
|
|
15
|
-
from tortoise.contrib.fastapi import register_tortoise
|
|
16
15
|
from loguru import logger
|
|
17
16
|
|
|
18
17
|
from infoman.config import settings, DatabaseConfig
|
|
@@ -245,15 +244,6 @@ class DatabaseManager:
|
|
|
245
244
|
await self.shutdown()
|
|
246
245
|
|
|
247
246
|
async def get_stats(self) -> Dict[str, Any]:
|
|
248
|
-
"""
|
|
249
|
-
获取统计信息
|
|
250
|
-
|
|
251
|
-
Returns:
|
|
252
|
-
{
|
|
253
|
-
"connections_count": int,
|
|
254
|
-
"connections": {...}
|
|
255
|
-
}
|
|
256
|
-
"""
|
|
257
247
|
if not self.is_available:
|
|
258
248
|
return {}
|
|
259
249
|
|