dimctx 0.1.0__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.
- dimctx/__init__.py +0 -0
- dimctx/core/__init__.py +0 -0
- dimctx/core/canon.py +117 -0
- dimctx/core/complexity.py +145 -0
- dimctx/core/detector.py +174 -0
- dimctx/core/matrix.py +123 -0
- dimctx/core/profiler.py +81 -0
- dimctx/models.py +57 -0
- dimctx/server.py +103 -0
- dimctx/tools.py +163 -0
- dimctx-0.1.0.dist-info/METADATA +73 -0
- dimctx-0.1.0.dist-info/RECORD +17 -0
- dimctx-0.1.0.dist-info/WHEEL +5 -0
- dimctx-0.1.0.dist-info/entry_points.txt +2 -0
- dimctx-0.1.0.dist-info/licenses/LICENSE +661 -0
- dimctx-0.1.0.dist-info/licenses/NOTICE +31 -0
- dimctx-0.1.0.dist-info/top_level.txt +1 -0
dimctx/models.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
"""models——MCP tool 返回类型(Pydantic v2;无 pydantic 时降级为 dataclass 便于单测)。"""
|
|
3
|
+
|
|
4
|
+
from typing import Dict, List, Optional
|
|
5
|
+
|
|
6
|
+
try: # pragma: no cover - 取决于环境
|
|
7
|
+
from pydantic import BaseModel
|
|
8
|
+
_HAS_PYDANTIC = True
|
|
9
|
+
except ImportError: # pragma: no cover
|
|
10
|
+
from dataclasses import dataclass
|
|
11
|
+
|
|
12
|
+
def BaseModel(**kw): # type: ignore
|
|
13
|
+
raise RuntimeError("pydantic 不可用")
|
|
14
|
+
|
|
15
|
+
_HAS_PYDANTIC = False
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class TableAnalysis(BaseModel): # type: ignore
|
|
19
|
+
role: str
|
|
20
|
+
grain: List[str] = []
|
|
21
|
+
scd_hint: str = ""
|
|
22
|
+
bus_matrix_cell: str = ""
|
|
23
|
+
canon_refs: List[str] = []
|
|
24
|
+
confidence: float = 0.0
|
|
25
|
+
signals: List[str] = []
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class CanonHit(BaseModel): # type: ignore
|
|
29
|
+
title: str
|
|
30
|
+
url: str = ""
|
|
31
|
+
date: str = ""
|
|
32
|
+
source: str = "canon"
|
|
33
|
+
score: float = 0.0
|
|
34
|
+
snippet: str = ""
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class MatrixCell(BaseModel): # type: ignore
|
|
38
|
+
dim: str
|
|
39
|
+
cell: str
|
|
40
|
+
column: str = ""
|
|
41
|
+
type: str = ""
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class MatrixView(BaseModel): # type: ignore
|
|
45
|
+
table: str = ""
|
|
46
|
+
cells: List[MatrixCell] = []
|
|
47
|
+
hits: int = 0
|
|
48
|
+
note: str = ""
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class ComplexityReport(BaseModel): # type: ignore
|
|
52
|
+
case_when: int = 0
|
|
53
|
+
join_depth: int = 0
|
|
54
|
+
subq_depth: int = 0
|
|
55
|
+
agg_nest: int = 0
|
|
56
|
+
verdict: str = "PASS"
|
|
57
|
+
guidance: str = ""
|
dimctx/server.py
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
"""server——MCP stdio server(薄协议封装;业务逻辑全在 tools.py/core/)。
|
|
3
|
+
|
|
4
|
+
启动:uvx dimctx (或 python -m dimctx.server)
|
|
5
|
+
IDE 接入(VS Code / Cursor / Continue):
|
|
6
|
+
{"command": "uvx", "args": ["dimctx"]}
|
|
7
|
+
数据边界(03 号):纯本地 stdio,无网络出口、无遥测、无云服务、不做托管。
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import json
|
|
11
|
+
import sys
|
|
12
|
+
|
|
13
|
+
from . import tools
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _mcp_available() -> bool:
|
|
17
|
+
try:
|
|
18
|
+
import mcp # noqa: F401
|
|
19
|
+
return True
|
|
20
|
+
except ImportError:
|
|
21
|
+
return False
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _make_server():
|
|
25
|
+
"""同时支持 mcp 1.x(FastMCP)与 2.x(MCPServer)。
|
|
26
|
+
|
|
27
|
+
判例(2026-11-27 实测):mcp 2.x 把 FastMCP 改名 MCPServer,且 1.x 的
|
|
28
|
+
`mcp.server.fastmcp` 在 2.x 会**故意抛 ModuleNotFoundError** 并提示迁移——
|
|
29
|
+
故必须按版本探测而不是 try/except ImportError 兜底(后者会被该异常击穿)。
|
|
30
|
+
"""
|
|
31
|
+
major = 1
|
|
32
|
+
try:
|
|
33
|
+
from importlib.metadata import version
|
|
34
|
+
major = int(version("mcp").split(".")[0])
|
|
35
|
+
except Exception:
|
|
36
|
+
try: # 兜底:直接探测新模块是否存在
|
|
37
|
+
import mcp.server.mcpserver # noqa: F401
|
|
38
|
+
major = 2
|
|
39
|
+
except Exception:
|
|
40
|
+
major = 1
|
|
41
|
+
if major >= 2:
|
|
42
|
+
from mcp.server.mcpserver import MCPServer
|
|
43
|
+
return MCPServer("dimctx")
|
|
44
|
+
from mcp.server.fastmcp import FastMCP
|
|
45
|
+
return FastMCP("dimctx")
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def build_server():
|
|
49
|
+
"""构造 MCP server(兼容 1.x/2.x)。"""
|
|
50
|
+
mcp = _make_server()
|
|
51
|
+
|
|
52
|
+
@mcp.tool()
|
|
53
|
+
def analyze_table(table: str = "", ddl: str = "") -> str:
|
|
54
|
+
"""判定一张表的角色(fact/dimension)、粒度键、SCD 建议与总线矩阵格值。
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
table: 图谱中的表名(如 dt_batch)。与 ddl 二选一。
|
|
58
|
+
ddl: CREATE TABLE 文本(table 不在图谱时使用)。
|
|
59
|
+
"""
|
|
60
|
+
return json.dumps(tools.analyze_table(table=table, ddl=ddl), ensure_ascii=False)
|
|
61
|
+
|
|
62
|
+
@mcp.tool()
|
|
63
|
+
def search_canon(query: str = "", limit: int = 5) -> str:
|
|
64
|
+
"""检索本地自备的 Kimball 方法论语料(原典 markdown)。
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
query: 检索词(中英文均可,如 "slowly changing dimension")。
|
|
68
|
+
limit: 返回条数上限(1-20)。
|
|
69
|
+
"""
|
|
70
|
+
return json.dumps(tools.search_canon(query=query, limit=limit), ensure_ascii=False)
|
|
71
|
+
|
|
72
|
+
@mcp.tool()
|
|
73
|
+
def bus_matrix(table: str = "", dim: str = "") -> str:
|
|
74
|
+
"""查询总线矩阵:单表全部格值 / 单维度实现表 / 全库概览。
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
table: 表名(返回该表各维度格值)。
|
|
78
|
+
dim: 维度概念名(如 supplier,返回全部实现表+类型一致性)。
|
|
79
|
+
"""
|
|
80
|
+
return json.dumps(tools.bus_matrix(table=table, dim=dim), ensure_ascii=False)
|
|
81
|
+
|
|
82
|
+
@mcp.tool()
|
|
83
|
+
def measure_sql(sql: str = "") -> str:
|
|
84
|
+
"""度量下游取数复杂度(CASE WHEN / JOIN 深度 / 子查询层数 / 聚合套聚合)。
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
sql: 待检查的 SQL 文本。
|
|
88
|
+
"""
|
|
89
|
+
return json.dumps(tools.measure_sql(sql=sql), ensure_ascii=False)
|
|
90
|
+
|
|
91
|
+
return mcp
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def main() -> int:
|
|
95
|
+
if not _mcp_available():
|
|
96
|
+
print("缺少 mcp 依赖:pip install mcp(或 uvx dimctx 会自动安装)", file=sys.stderr)
|
|
97
|
+
return 2
|
|
98
|
+
build_server().run()
|
|
99
|
+
return 0
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
if __name__ == "__main__":
|
|
103
|
+
sys.exit(main())
|
dimctx/tools.py
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
"""tools——四个 MCP tool 的实现(纯逻辑,便于单测;server.py 仅做协议封装)。"""
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import re
|
|
6
|
+
from typing import Dict, List, Optional
|
|
7
|
+
|
|
8
|
+
from .core import canon as canon_mod
|
|
9
|
+
from .core import complexity, detector, matrix, profiler
|
|
10
|
+
|
|
11
|
+
_INDEX = None
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _atlas_path() -> Optional[str]:
|
|
15
|
+
p = os.environ.get("DIMCTX_ATLAS", "")
|
|
16
|
+
if p and os.path.exists(p):
|
|
17
|
+
return p
|
|
18
|
+
here = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
19
|
+
for cand in (os.path.join(here, "data", "atlas.json"),
|
|
20
|
+
os.path.join(os.path.dirname(here), "data", "atlas.json")):
|
|
21
|
+
if os.path.exists(cand):
|
|
22
|
+
return cand
|
|
23
|
+
return None
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _canon_dir() -> str:
|
|
27
|
+
return os.environ.get("DIMCTX_CANON_DIR", "")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _analysis_dir() -> Optional[str]:
|
|
31
|
+
p = os.environ.get("DIMCTX_ANALYSIS_DIR", "")
|
|
32
|
+
return p if p else None
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def get_index():
|
|
36
|
+
global _INDEX
|
|
37
|
+
if _INDEX is None:
|
|
38
|
+
_INDEX = canon_mod.build_index(_canon_dir(), _analysis_dir())
|
|
39
|
+
return _INDEX
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# ---------- Tool 1:analyze_table ----------
|
|
43
|
+
|
|
44
|
+
_DDL_COL = re.compile(r"^\s*`?([A-Za-z_][\w]*)`?\s+([A-Za-z]+(?:\([\d,\s]+\))?)", re.M)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
_DDL_SKIP = {"CREATE", "TABLE", "PRIMARY", "KEY", "UNIQUE", "INDEX", "DUPLICATE",
|
|
48
|
+
"AGGREGATE", "DISTRIBUTED", "PROPERTIES", "PARTITION", "BUCKETS",
|
|
49
|
+
"ENGINE", "COMMENT", "DEFAULT", "NULL", "NOT", "ASYNC", "WRITE",
|
|
50
|
+
"ENABLE", "DYNAMIC", "REPLICATION", "STORAGE", "MEDIUM", "HASH", "RANGE"}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _parse_ddl(ddl: str) -> Dict[str, Dict]:
|
|
54
|
+
"""解析 CREATE TABLE:优先「行首反引号/标识符 + 类型」,跳过键/属性行。
|
|
55
|
+
|
|
56
|
+
判例:初版把 DUPLICATE KEY(...) 里的 batch_no 当列、并把 DISTRIBUTED 当类型,
|
|
57
|
+
导致列集污染 → 画像失真。修法=只认括号内「行首」列定义且名字不在保留字表。
|
|
58
|
+
"""
|
|
59
|
+
cols = {}
|
|
60
|
+
body = ddl
|
|
61
|
+
m = re.search(r"\bCREATE\s+TABLE[^(]*\((.*)\)\s*(?:ENGINE|DUPLICATE|UNIQUE|AGGREGATE|DISTRIBUTED|PROPERTIES|$)",
|
|
62
|
+
ddl, re.S | re.I)
|
|
63
|
+
if m:
|
|
64
|
+
body = m.group(1)
|
|
65
|
+
for line in body.splitlines():
|
|
66
|
+
s = line.strip().rstrip(",")
|
|
67
|
+
mm = re.match(r"^`?([A-Za-z_][\w]*)`?\s+([A-Za-z]+(?:\s*varying)?(?:\s*\([\d,\s]+\))?)", s)
|
|
68
|
+
if not mm:
|
|
69
|
+
continue
|
|
70
|
+
name, typ = mm.group(1), mm.group(2)
|
|
71
|
+
if name.upper() in _DDL_SKIP or name.upper().startswith(("PRIMARY", "UNIQUE", "INDEX", "KEY")):
|
|
72
|
+
continue
|
|
73
|
+
cols[name] = {"type": typ, "comment": ""}
|
|
74
|
+
return cols
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def analyze_table(table: str = "", ddl: str = "") -> Dict:
|
|
78
|
+
"""判定角色/粒度/SCD/矩阵格+原典指引。table=图谱表名优先,否则用 ddl 文本。"""
|
|
79
|
+
atlas_p = _atlas_path()
|
|
80
|
+
atlas = matrix.load_atlas(atlas_p) if atlas_p else None
|
|
81
|
+
columns: Dict[str, Dict] = {}
|
|
82
|
+
name = table
|
|
83
|
+
|
|
84
|
+
if atlas and table and table in atlas["tables"]:
|
|
85
|
+
columns = atlas["tables"][table].get("columns") or {}
|
|
86
|
+
elif ddl:
|
|
87
|
+
columns = _parse_ddl(ddl)
|
|
88
|
+
name = table or "(inline ddl)"
|
|
89
|
+
if not columns:
|
|
90
|
+
return {"role": "unknown", "grain": [], "scd_hint": "", "bus_matrix_cell": "",
|
|
91
|
+
"canon_refs": [], "confidence": 0.0,
|
|
92
|
+
"signals": ["未找到表(既非图谱表也无 DDL)"]}
|
|
93
|
+
|
|
94
|
+
p = profiler.profile_table(name, columns)
|
|
95
|
+
role = detector.classify_role(p)
|
|
96
|
+
grain = detector.guess_grain(p, role["role"])
|
|
97
|
+
scd = detector.detect_scd(p, columns)
|
|
98
|
+
|
|
99
|
+
cell = ""
|
|
100
|
+
if atlas and name in (atlas.get("tables") or {}):
|
|
101
|
+
tv = matrix.table_view(atlas, name)
|
|
102
|
+
if tv:
|
|
103
|
+
cell = f"{tv['hits']}/{len(tv['cells'])} 维度命中"
|
|
104
|
+
|
|
105
|
+
idx = get_index()
|
|
106
|
+
refs: List[str] = []
|
|
107
|
+
if idx.N:
|
|
108
|
+
q = f"{'SCD slowly changing dimension' if scd.get('scd') == 'type2' else 'dimensional modeling grain'} {role['role']}"
|
|
109
|
+
refs = [h["url"] or h["title"] for h in idx.search(q, 3)]
|
|
110
|
+
|
|
111
|
+
conf = min(1.0, abs(role["fact_score"] - role["dim_score"]) / 4.0)
|
|
112
|
+
return {"role": role["role"], "grain": grain,
|
|
113
|
+
"scd_hint": scd.get("scd", ""), "bus_matrix_cell": cell,
|
|
114
|
+
"canon_refs": refs, "confidence": round(conf, 2),
|
|
115
|
+
"signals": role.get("signals", [])}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# ---------- Tool 2:search_canon ----------
|
|
119
|
+
|
|
120
|
+
def search_canon(query: str, limit: int = 5) -> Dict:
|
|
121
|
+
idx = get_index()
|
|
122
|
+
if not idx.N:
|
|
123
|
+
return {"hits": [], "note": "语料未配置:设置 DIMCTX_CANON_DIR 指向自备 markdown 目录(本项目不分发原典内容)"}
|
|
124
|
+
return {"hits": idx.search(query, max(1, min(limit, 20))), "note": ""}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
# ---------- Tool 3:bus_matrix ----------
|
|
128
|
+
|
|
129
|
+
def bus_matrix(table: str = "", dim: str = "") -> Dict:
|
|
130
|
+
atlas_p = _atlas_path()
|
|
131
|
+
atlas = matrix.load_atlas(atlas_p) if atlas_p else None
|
|
132
|
+
if not atlas:
|
|
133
|
+
return {"table": table, "cells": [], "hits": 0, "note": "图谱未配置(设置 DIMCTX_ATLAS)"}
|
|
134
|
+
if dim:
|
|
135
|
+
v = matrix.dimension_view(atlas, dim)
|
|
136
|
+
return {"table": "", "cells": [], "hits": len(v["implementations"]),
|
|
137
|
+
"note": f"维度 {dim}:{len(v['implementations'])} 个实现,"
|
|
138
|
+
f"{'类型一致' if v['consistent'] else '类型不一致 ' + str(v['type_groups'])}"}
|
|
139
|
+
if table:
|
|
140
|
+
tv = matrix.table_view(atlas, table)
|
|
141
|
+
if not tv:
|
|
142
|
+
return {"table": table, "cells": [], "hits": 0, "note": f"{table} 不在 DT 结果层"}
|
|
143
|
+
return {"table": table, "cells": [c for c in tv["cells"] if c["cell"] == "✓"],
|
|
144
|
+
"hits": tv["hits"], "note": ""}
|
|
145
|
+
ov = matrix.overview(atlas)
|
|
146
|
+
return {"table": "", "cells": [], "hits": ov["cells_hit"],
|
|
147
|
+
"note": f"{ov['rows']} 行 × {ov['cols']} 列,{ov['cells_hit']} 格命中;"
|
|
148
|
+
f"类型不一致维度 {len(ov['inconsistent_dims'])} 个"}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
# ---------- Tool 4:measure_sql ----------
|
|
152
|
+
|
|
153
|
+
def measure_sql(sql: str) -> Dict:
|
|
154
|
+
m = complexity.analyze_statement(sql)
|
|
155
|
+
high = m["agg_nest"] > 0 or m["subq_depth"] >= 2 or m["case_when"] >= 3
|
|
156
|
+
med = m["case_when"] >= 1 or m["subq_depth"] >= 1 or m["join_depth"] >= 3
|
|
157
|
+
verdict = "HIGH" if high else ("MED" if med else "PASS")
|
|
158
|
+
guidance = {
|
|
159
|
+
"PASS": "下游仅 SELECT/WHERE,符合 Kimball「口径内置」判据。",
|
|
160
|
+
"MED": "存在轻度口径外置(CASE WHEN/子查询/JOIN≥3)——建议把口径收进模型层。",
|
|
161
|
+
"HIGH": "口径严重外置(聚合套聚合/多层子查询/CASE WHEN≥3)——底层模型不合格,应先修模型。",
|
|
162
|
+
}[verdict]
|
|
163
|
+
return {**m, "verdict": verdict, "guidance": guidance}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dimctx
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: dimctx = dimensional modeling context provider — MCP server giving AI coding assistants Kimball modeling judgement, bus-matrix truth, and SQL complexity checks.
|
|
5
|
+
Author: wagic
|
|
6
|
+
License: AGPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/SeekerGalahad/dimctx
|
|
8
|
+
Keywords: mcp,dimensional-modeling,data-warehouse,kimball,semantic-layer
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
|
|
11
|
+
Classifier: Topic :: Database
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
License-File: NOTICE
|
|
16
|
+
Requires-Dist: mcp>=1.0.0
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
19
|
+
Requires-Dist: pydantic>=2; extra == "dev"
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# dimctx
|
|
23
|
+
|
|
24
|
+
> **dimctx = dimensional modeling context provider**
|
|
25
|
+
> 一个本地 MCP server,让你的 AI 编码助手在写数仓代码时拥有维度建模的判断力。
|
|
26
|
+
|
|
27
|
+
[](LICENSE)
|
|
28
|
+
|
|
29
|
+
## 它解决什么
|
|
30
|
+
|
|
31
|
+
AI 写 SQL/DDL 时会瞎编建模决策:分不清事实和维度、猜不准粒度、不知道哪些维度该跨表一致。
|
|
32
|
+
`dimctx` 把这些判断交给确定性引擎 + 你自己的方法论语料。
|
|
33
|
+
|
|
34
|
+
四个工具:
|
|
35
|
+
|
|
36
|
+
| 工具 | 作用 |
|
|
37
|
+
|---|---|
|
|
38
|
+
| `analyze_table` | 判定表角色(fact/dimension)、粒度键、SCD 建议、总线矩阵格值 |
|
|
39
|
+
| `search_canon` | 检索**你自备**的建模语料(本地 markdown) |
|
|
40
|
+
| `bus_matrix` | 总线矩阵查询(单表格值 / 单维度实现 / 全库概览) |
|
|
41
|
+
| `measure_sql` | 度量下游取数复杂度(CASE WHEN / JOIN 深度 / 子查询 / 聚合嵌套) |
|
|
42
|
+
|
|
43
|
+
## 三步接入
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# 1) 配置(可选,缺省也能跑:只是语料检索为空)
|
|
47
|
+
export DIMCTX_ATLAS=/path/to/atlas.json # 工程表图谱(可选)
|
|
48
|
+
export DIMCTX_CANON_DIR=/path/to/markdown # 你自备的建模语料(可选)
|
|
49
|
+
|
|
50
|
+
# 2) 在 IDE 的 MCP 配置里加一条
|
|
51
|
+
# VS Code (mcp.json) / Cursor (.cursor/mcp.json) / Continue (config.yaml)
|
|
52
|
+
{"command": "uvx", "args": ["dimctx"]}
|
|
53
|
+
|
|
54
|
+
# 3) 让 AI 用它
|
|
55
|
+
# 「用 dimctx 看看 dt_batch 是什么表、粒度是什么」
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 数据边界(重要)
|
|
59
|
+
|
|
60
|
+
- **纯本地 stdio**:无网络出口、无遥测、无云服务、不做托管;
|
|
61
|
+
- **不打包任何第三方内容**:语料由你自备(详见 [`docs/DATA-POLICY.md`](docs/DATA-POLICY.md) 与 [`NOTICE`](NOTICE));
|
|
62
|
+
- 未配置语料时 `search_canon` 返回空并提示配置,**不会报错、不会联网索取**。
|
|
63
|
+
|
|
64
|
+
## 开发
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
uv run --with pytest --with pydantic python -m pytest tests/ -q # 19 passed
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 许可
|
|
71
|
+
|
|
72
|
+
代码 AGPL-3.0-or-later(见 [LICENSE](LICENSE))。本项目与 Kimball Group 无关联、未获其背书;
|
|
73
|
+
文档中提及 Kimball 方法论属指名性合理使用(nominative fair use)。
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
dimctx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
dimctx/models.py,sha256=bJEn5N4vL1RjfcOBiumqgjwVkKFJGw6DFXgUlBldPt8,1341
|
|
3
|
+
dimctx/server.py,sha256=AGtT-pTH5Ro3R4Y9dg-ImtQmxiTbV2781SEuWDUAuaU,3452
|
|
4
|
+
dimctx/tools.py,sha256=t6Bm1NT_gSZtZJqBf7pgAzwQVqfO_KBLfDPXTbiu2yY,6638
|
|
5
|
+
dimctx/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
dimctx/core/canon.py,sha256=8ZAls4Nbsu6DKOYvIRhWTbg2AZortY-Bhar8iNCHe_I,4364
|
|
7
|
+
dimctx/core/complexity.py,sha256=q_sIfx-eG042aLzOw7b6HAf8GmkuE-JTiQr2nwnM-kg,5656
|
|
8
|
+
dimctx/core/detector.py,sha256=MyTE3PZNEa1CBbDxdH4CqwSvxk4PoL29WUNFY_ewzjM,7401
|
|
9
|
+
dimctx/core/matrix.py,sha256=fdFGS_afQTGfW6vpCY-qLIbyZrPJ0PyGyeUMd9w3oyY,4804
|
|
10
|
+
dimctx/core/profiler.py,sha256=zNAQymrTiaeW-oZ4drluq-iY9T_huVRHYB0jVnwnwYU,3683
|
|
11
|
+
dimctx-0.1.0.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
|
12
|
+
dimctx-0.1.0.dist-info/licenses/NOTICE,sha256=2g14r7vQY5Adbeu-fbvifCXY32C_B6ZYyhoR1lHUfAg,1541
|
|
13
|
+
dimctx-0.1.0.dist-info/METADATA,sha256=ST6J66E5ouvu6QX6jTdHXW5hwEu6NAfEDik7fwe91rs,2939
|
|
14
|
+
dimctx-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
15
|
+
dimctx-0.1.0.dist-info/entry_points.txt,sha256=kUeQW3p82BkA6l00Ylh1ZT88Gw19cpvg-GnQCupZPpM,46
|
|
16
|
+
dimctx-0.1.0.dist-info/top_level.txt,sha256=2eZ3icrtO0arlVulwp2m4YEUOBSztEMoZYxqwf6XAQU,7
|
|
17
|
+
dimctx-0.1.0.dist-info/RECORD,,
|