cnhkmcp 1.4.5__py3-none-any.whl → 1.4.6__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.
- cnhkmcp/__init__.py +1 -1
- cnhkmcp/untracked/mcp/321/206/320/246/320/227/321/204/342/225/227/342/225/242/321/210/320/276/342/225/221/321/205/320/255/320/253/321/207/320/231/320/2302_/321/205/320/266/320/222/321/206/320/256/320/254/321/205/320/236/320/257/321/207/320/231/320/230/321/205/320/240/320/277/321/205/320/232/320/270/321/204/342/225/225/320/235/321/204/342/225/221/320/226/321/206/342/225/241/320/237/321/210/320/267/320/230/321/205/320/251/320/270/321/205/342/226/221/342/226/222/321/210/320/277/320/245/321/210/342/224/220/320/251/321/204/342/225/225/320/272//321/211/320/225/320/235/321/207/342/225/234/320/276/321/205/320/231/320/235/321/210/342/224/220/320/240/321/210/320/261/320/234/321/206/320/230/320/241_/321/205/320/276/320/231/321/210/320/263/320/225/321/205/342/224/220/320/225/321/210/320/266/320/221/321/204/342/225/233/320/255/321/210/342/225/241/320/246/321/205/320/234/320/225.py +165 -0
- cnhkmcp/untracked//321/211/320/225/320/235/321/207/342/225/234/320/276/321/205/320/231/320/235/321/210/342/224/220/320/240/321/210/320/261/320/234/321/206/320/230/320/241_/321/205/320/276/320/231/321/210/320/263/320/225/321/205/342/224/220/320/225/321/210/320/266/320/221/321/204/342/225/233/320/255/321/210/342/225/241/320/246/321/205/320/234/320/225.py +165 -0
- {cnhkmcp-1.4.5.dist-info → cnhkmcp-1.4.6.dist-info}/METADATA +1 -1
- {cnhkmcp-1.4.5.dist-info → cnhkmcp-1.4.6.dist-info}/RECORD +9 -7
- {cnhkmcp-1.4.5.dist-info → cnhkmcp-1.4.6.dist-info}/WHEEL +0 -0
- {cnhkmcp-1.4.5.dist-info → cnhkmcp-1.4.6.dist-info}/entry_points.txt +0 -0
- {cnhkmcp-1.4.5.dist-info → cnhkmcp-1.4.6.dist-info}/licenses/LICENSE +0 -0
- {cnhkmcp-1.4.5.dist-info → cnhkmcp-1.4.6.dist-info}/top_level.txt +0 -0
cnhkmcp/__init__.py
CHANGED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"""
|
|
2
|
+
check_install_packages.py
|
|
3
|
+
|
|
4
|
+
Simple script that hardcodes the project's required packages and ensures they are installed
|
|
5
|
+
before running the server or tests. It will install missing packages (or upgrade if below
|
|
6
|
+
required version) by invoking pip via the running Python interpreter.
|
|
7
|
+
|
|
8
|
+
Usage: python check_install_packages.py
|
|
9
|
+
|
|
10
|
+
This script is intentionally conservative: it uses the distribution/package names from
|
|
11
|
+
`requirements.txt` and calls pip to install the exact spec (e.g. "requests>=2.31.0").
|
|
12
|
+
It prints a concise summary at the end.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import sys
|
|
17
|
+
import subprocess
|
|
18
|
+
import importlib
|
|
19
|
+
import importlib.metadata
|
|
20
|
+
import re
|
|
21
|
+
from typing import List, Tuple, Optional
|
|
22
|
+
|
|
23
|
+
# Hardcoded package requirements (from requirements.txt)
|
|
24
|
+
REQUIRED_PACKAGES: List[str] = [
|
|
25
|
+
"fastmcp>=0.1.0",
|
|
26
|
+
"requests>=2.31.0",
|
|
27
|
+
"pandas>=2.0.0",
|
|
28
|
+
"selenium>=4.15.0",
|
|
29
|
+
"beautifulsoup4>=4.12.0",
|
|
30
|
+
"pydantic>=2.0.0",
|
|
31
|
+
"email-validator>=2.0.0",
|
|
32
|
+
"aiohttp>=3.8.0",
|
|
33
|
+
"webdriver-manager>=4.0.0"
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def parse_spec(spec: str) -> Tuple[str, Optional[str]]:
|
|
38
|
+
"""Return (name, min_version) for a spec like 'pkg>=1.2.3'."""
|
|
39
|
+
if ">=" in spec:
|
|
40
|
+
name, ver = spec.split(">=", 1)
|
|
41
|
+
return name.strip(), ver.strip()
|
|
42
|
+
return spec.strip(), None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def version_tuple(v: str) -> List[int]:
|
|
46
|
+
parts = re.split(r"[^0-9]+", v)
|
|
47
|
+
nums = []
|
|
48
|
+
for p in parts:
|
|
49
|
+
if p == "":
|
|
50
|
+
continue
|
|
51
|
+
try:
|
|
52
|
+
nums.append(int(p))
|
|
53
|
+
except ValueError:
|
|
54
|
+
# Non-numeric part, stop parsing further
|
|
55
|
+
break
|
|
56
|
+
return nums
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def is_version_sufficient(installed: str, required: str) -> bool:
|
|
60
|
+
if not installed:
|
|
61
|
+
return False
|
|
62
|
+
try:
|
|
63
|
+
i_parts = version_tuple(installed)
|
|
64
|
+
r_parts = version_tuple(required)
|
|
65
|
+
# Compare element-wise
|
|
66
|
+
for a, b in zip(i_parts, r_parts):
|
|
67
|
+
if a > b:
|
|
68
|
+
return True
|
|
69
|
+
if a < b:
|
|
70
|
+
return False
|
|
71
|
+
# If equal up to the length of required, installed is sufficient if it's at least as long
|
|
72
|
+
return len(i_parts) >= len(r_parts)
|
|
73
|
+
except Exception:
|
|
74
|
+
return False
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def install_package(spec: str) -> Tuple[bool, str]:
|
|
78
|
+
"""Install a package spec using pip. Returns (success, output)."""
|
|
79
|
+
cmd = [sys.executable, "-m", "pip", "install", spec]
|
|
80
|
+
try:
|
|
81
|
+
completed = subprocess.run(cmd, capture_output=True, text=True)
|
|
82
|
+
out = completed.stdout + "\n" + completed.stderr
|
|
83
|
+
success = completed.returncode == 0
|
|
84
|
+
return success, out
|
|
85
|
+
except Exception as e:
|
|
86
|
+
return False, str(e)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def main():
|
|
90
|
+
results = []
|
|
91
|
+
print("Checking required packages...\n")
|
|
92
|
+
for spec in REQUIRED_PACKAGES:
|
|
93
|
+
name, min_ver = parse_spec(spec)
|
|
94
|
+
installed_ver = None
|
|
95
|
+
try:
|
|
96
|
+
installed_ver = importlib.metadata.version(name)
|
|
97
|
+
except importlib.metadata.PackageNotFoundError:
|
|
98
|
+
installed_ver = None
|
|
99
|
+
except Exception:
|
|
100
|
+
# Some packages may have different distribution vs import names; try best-effort
|
|
101
|
+
installed_ver = None
|
|
102
|
+
|
|
103
|
+
needs_install = False
|
|
104
|
+
action = "present"
|
|
105
|
+
if installed_ver is None:
|
|
106
|
+
needs_install = True
|
|
107
|
+
action = "install"
|
|
108
|
+
elif min_ver is not None:
|
|
109
|
+
if not is_version_sufficient(installed_ver, min_ver):
|
|
110
|
+
needs_install = True
|
|
111
|
+
action = f"upgrade (installed {installed_ver} < required {min_ver})"
|
|
112
|
+
|
|
113
|
+
if needs_install:
|
|
114
|
+
print(f"-> {name}: {action} via pip ({spec})")
|
|
115
|
+
success, output = install_package(spec)
|
|
116
|
+
results.append({
|
|
117
|
+
"name": name,
|
|
118
|
+
"spec": spec,
|
|
119
|
+
"installed_version_before": installed_ver,
|
|
120
|
+
"action": action,
|
|
121
|
+
"success": success,
|
|
122
|
+
"output": output
|
|
123
|
+
})
|
|
124
|
+
else:
|
|
125
|
+
print(f"-> {name}: OK (installed: {installed_ver})")
|
|
126
|
+
results.append({
|
|
127
|
+
"name": name,
|
|
128
|
+
"spec": spec,
|
|
129
|
+
"installed_version_before": installed_ver,
|
|
130
|
+
"action": "none",
|
|
131
|
+
"success": True,
|
|
132
|
+
"output": ""
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
# Summary
|
|
136
|
+
print("\nSummary:")
|
|
137
|
+
installed_count = sum(1 for r in results if r["success"] and r["action"] == "none")
|
|
138
|
+
installed_or_fixed = sum(1 for r in results if r["success"] and r["action"] != "none")
|
|
139
|
+
failed = [r for r in results if not r["success"]]
|
|
140
|
+
|
|
141
|
+
print(f" Packages already OK: {installed_count}")
|
|
142
|
+
print(f" Packages installed/upgraded by this script: {installed_or_fixed}")
|
|
143
|
+
print(f" Packages failed to install: {len(failed)}")
|
|
144
|
+
if failed:
|
|
145
|
+
for f in failed:
|
|
146
|
+
print(f" - {f['name']}: attempted '{f['spec']}' -> error (see details below)")
|
|
147
|
+
|
|
148
|
+
# If any failed, print their outputs for debugging
|
|
149
|
+
if failed:
|
|
150
|
+
print("\nFailed install details:\n")
|
|
151
|
+
for f in failed:
|
|
152
|
+
print("-----")
|
|
153
|
+
print(f"Package: {f['name']}")
|
|
154
|
+
print(f"Spec: {f['spec']}")
|
|
155
|
+
print("Output:")
|
|
156
|
+
print(f.get("output", "(no output)"))
|
|
157
|
+
|
|
158
|
+
print("\nDone.")
|
|
159
|
+
# Exit with non-zero code if any install failed
|
|
160
|
+
if failed:
|
|
161
|
+
sys.exit(2)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
if __name__ == "__main__":
|
|
165
|
+
main()
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"""
|
|
2
|
+
check_install_packages.py
|
|
3
|
+
|
|
4
|
+
Simple script that hardcodes the project's required packages and ensures they are installed
|
|
5
|
+
before running the server or tests. It will install missing packages (or upgrade if below
|
|
6
|
+
required version) by invoking pip via the running Python interpreter.
|
|
7
|
+
|
|
8
|
+
Usage: python check_install_packages.py
|
|
9
|
+
|
|
10
|
+
This script is intentionally conservative: it uses the distribution/package names from
|
|
11
|
+
`requirements.txt` and calls pip to install the exact spec (e.g. "requests>=2.31.0").
|
|
12
|
+
It prints a concise summary at the end.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import sys
|
|
17
|
+
import subprocess
|
|
18
|
+
import importlib
|
|
19
|
+
import importlib.metadata
|
|
20
|
+
import re
|
|
21
|
+
from typing import List, Tuple, Optional
|
|
22
|
+
|
|
23
|
+
# Hardcoded package requirements (from requirements.txt)
|
|
24
|
+
REQUIRED_PACKAGES: List[str] = [
|
|
25
|
+
"fastmcp>=0.1.0",
|
|
26
|
+
"requests>=2.31.0",
|
|
27
|
+
"pandas>=2.0.0",
|
|
28
|
+
"selenium>=4.15.0",
|
|
29
|
+
"beautifulsoup4>=4.12.0",
|
|
30
|
+
"pydantic>=2.0.0",
|
|
31
|
+
"email-validator>=2.0.0",
|
|
32
|
+
"aiohttp>=3.8.0",
|
|
33
|
+
"webdriver-manager>=4.0.0"
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def parse_spec(spec: str) -> Tuple[str, Optional[str]]:
|
|
38
|
+
"""Return (name, min_version) for a spec like 'pkg>=1.2.3'."""
|
|
39
|
+
if ">=" in spec:
|
|
40
|
+
name, ver = spec.split(">=", 1)
|
|
41
|
+
return name.strip(), ver.strip()
|
|
42
|
+
return spec.strip(), None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def version_tuple(v: str) -> List[int]:
|
|
46
|
+
parts = re.split(r"[^0-9]+", v)
|
|
47
|
+
nums = []
|
|
48
|
+
for p in parts:
|
|
49
|
+
if p == "":
|
|
50
|
+
continue
|
|
51
|
+
try:
|
|
52
|
+
nums.append(int(p))
|
|
53
|
+
except ValueError:
|
|
54
|
+
# Non-numeric part, stop parsing further
|
|
55
|
+
break
|
|
56
|
+
return nums
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def is_version_sufficient(installed: str, required: str) -> bool:
|
|
60
|
+
if not installed:
|
|
61
|
+
return False
|
|
62
|
+
try:
|
|
63
|
+
i_parts = version_tuple(installed)
|
|
64
|
+
r_parts = version_tuple(required)
|
|
65
|
+
# Compare element-wise
|
|
66
|
+
for a, b in zip(i_parts, r_parts):
|
|
67
|
+
if a > b:
|
|
68
|
+
return True
|
|
69
|
+
if a < b:
|
|
70
|
+
return False
|
|
71
|
+
# If equal up to the length of required, installed is sufficient if it's at least as long
|
|
72
|
+
return len(i_parts) >= len(r_parts)
|
|
73
|
+
except Exception:
|
|
74
|
+
return False
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def install_package(spec: str) -> Tuple[bool, str]:
|
|
78
|
+
"""Install a package spec using pip. Returns (success, output)."""
|
|
79
|
+
cmd = [sys.executable, "-m", "pip", "install", spec]
|
|
80
|
+
try:
|
|
81
|
+
completed = subprocess.run(cmd, capture_output=True, text=True)
|
|
82
|
+
out = completed.stdout + "\n" + completed.stderr
|
|
83
|
+
success = completed.returncode == 0
|
|
84
|
+
return success, out
|
|
85
|
+
except Exception as e:
|
|
86
|
+
return False, str(e)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def main():
|
|
90
|
+
results = []
|
|
91
|
+
print("Checking required packages...\n")
|
|
92
|
+
for spec in REQUIRED_PACKAGES:
|
|
93
|
+
name, min_ver = parse_spec(spec)
|
|
94
|
+
installed_ver = None
|
|
95
|
+
try:
|
|
96
|
+
installed_ver = importlib.metadata.version(name)
|
|
97
|
+
except importlib.metadata.PackageNotFoundError:
|
|
98
|
+
installed_ver = None
|
|
99
|
+
except Exception:
|
|
100
|
+
# Some packages may have different distribution vs import names; try best-effort
|
|
101
|
+
installed_ver = None
|
|
102
|
+
|
|
103
|
+
needs_install = False
|
|
104
|
+
action = "present"
|
|
105
|
+
if installed_ver is None:
|
|
106
|
+
needs_install = True
|
|
107
|
+
action = "install"
|
|
108
|
+
elif min_ver is not None:
|
|
109
|
+
if not is_version_sufficient(installed_ver, min_ver):
|
|
110
|
+
needs_install = True
|
|
111
|
+
action = f"upgrade (installed {installed_ver} < required {min_ver})"
|
|
112
|
+
|
|
113
|
+
if needs_install:
|
|
114
|
+
print(f"-> {name}: {action} via pip ({spec})")
|
|
115
|
+
success, output = install_package(spec)
|
|
116
|
+
results.append({
|
|
117
|
+
"name": name,
|
|
118
|
+
"spec": spec,
|
|
119
|
+
"installed_version_before": installed_ver,
|
|
120
|
+
"action": action,
|
|
121
|
+
"success": success,
|
|
122
|
+
"output": output
|
|
123
|
+
})
|
|
124
|
+
else:
|
|
125
|
+
print(f"-> {name}: OK (installed: {installed_ver})")
|
|
126
|
+
results.append({
|
|
127
|
+
"name": name,
|
|
128
|
+
"spec": spec,
|
|
129
|
+
"installed_version_before": installed_ver,
|
|
130
|
+
"action": "none",
|
|
131
|
+
"success": True,
|
|
132
|
+
"output": ""
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
# Summary
|
|
136
|
+
print("\nSummary:")
|
|
137
|
+
installed_count = sum(1 for r in results if r["success"] and r["action"] == "none")
|
|
138
|
+
installed_or_fixed = sum(1 for r in results if r["success"] and r["action"] != "none")
|
|
139
|
+
failed = [r for r in results if not r["success"]]
|
|
140
|
+
|
|
141
|
+
print(f" Packages already OK: {installed_count}")
|
|
142
|
+
print(f" Packages installed/upgraded by this script: {installed_or_fixed}")
|
|
143
|
+
print(f" Packages failed to install: {len(failed)}")
|
|
144
|
+
if failed:
|
|
145
|
+
for f in failed:
|
|
146
|
+
print(f" - {f['name']}: attempted '{f['spec']}' -> error (see details below)")
|
|
147
|
+
|
|
148
|
+
# If any failed, print their outputs for debugging
|
|
149
|
+
if failed:
|
|
150
|
+
print("\nFailed install details:\n")
|
|
151
|
+
for f in failed:
|
|
152
|
+
print("-----")
|
|
153
|
+
print(f"Package: {f['name']}")
|
|
154
|
+
print(f"Spec: {f['spec']}")
|
|
155
|
+
print("Output:")
|
|
156
|
+
print(f.get("output", "(no output)"))
|
|
157
|
+
|
|
158
|
+
print("\nDone.")
|
|
159
|
+
# Exit with non-zero code if any install failed
|
|
160
|
+
if failed:
|
|
161
|
+
sys.exit(2)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
if __name__ == "__main__":
|
|
165
|
+
main()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
cnhkmcp/__init__.py,sha256=
|
|
1
|
+
cnhkmcp/__init__.py,sha256=RUgGuR1wbpYSNJFO_yA0qkWU4oSd4ewXEegj-n7i4ss,2758
|
|
2
2
|
cnhkmcp/untracked/arXiv_API_Tool_Manual.md,sha256=I3hvI5mpmIjBuWptufoVSWFnuhyUc67oCGHEuR0p_xs,13552
|
|
3
3
|
cnhkmcp/untracked/arxiv_api.py,sha256=-E-Ub9K-DXAYaCjrbobyfQ9H97gaZBc7pL6xPEyVHec,9020
|
|
4
4
|
cnhkmcp/untracked/forum_functions.py,sha256=QW-CplAsqDkw-Wcwq-1tuZBq48dEO-vXZ8xw7X65EuE,42303
|
|
@@ -11,6 +11,7 @@ cnhkmcp/untracked/示例工作流_BRAIN_6_Tips_Datafield_Exploration_Guide.md,sh
|
|
|
11
11
|
cnhkmcp/untracked/示例工作流_BRAIN_Alpha_Improvement_Workflow.md,sha256=XlWYREd_qXe1skdXIhkiGY05oDr_6KiBs1WkerY4S8U,5092
|
|
12
12
|
cnhkmcp/untracked/示例工作流_Dataset_Exploration_Expert_Manual.md,sha256=-C4fWdaBe9UzA5BDZz0Do2z8RaPWLslb6D0nTz6fqk4,24403
|
|
13
13
|
cnhkmcp/untracked/示例工作流_daily_report_workflow.md,sha256=6aNmPqWRn09XdQMRxoVTka9IYVOUv5LcWparHu16EfQ,9460
|
|
14
|
+
cnhkmcp/untracked/配置前运行我_安装必要依赖包.py,sha256=2TDQKMo1sMwELUROgWTUolVYX1-zusUv54lrW3HCuUg,5464
|
|
14
15
|
cnhkmcp/untracked/APP/.gitignore,sha256=oPCoVTNo82bhkN0c671LdjCpOTVpVhZI5NR75ztcg48,317
|
|
15
16
|
cnhkmcp/untracked/APP/MODULAR_STRUCTURE.md,sha256=Ji4VeRZjeMWRX6cvEHxyR_gmoorIEEdqwsXTCVIr5_0,4331
|
|
16
17
|
cnhkmcp/untracked/APP/README.md,sha256=vb7hmQX0sH5aFNBmDCN5szMSDHm1_h2VKY4UKCt0aMk,11676
|
|
@@ -64,9 +65,10 @@ cnhkmcp/untracked/mcp文件论坛版2_如果原版启动不了浏览器就试这
|
|
|
64
65
|
cnhkmcp/untracked/mcp文件论坛版2_如果原版启动不了浏览器就试这个/platform_functions.py,sha256=aa5jCRjCORFars8CVahqwbk5ni0mLYWu9yND7Z4TGUM,99159
|
|
65
66
|
cnhkmcp/untracked/mcp文件论坛版2_如果原版启动不了浏览器就试这个/user_config.json,sha256=_INn1X1qIsITrmEno-BRlQOAGm9wnNCw-6B333DEvnk,695
|
|
66
67
|
cnhkmcp/untracked/mcp文件论坛版2_如果原版启动不了浏览器就试这个/让AI读这个文档来学会下载浏览器.md,sha256=AQsW5HNmuQ2XCl7bY1lVp1mCXuKOjoNtmLuXJyoS_oQ,3234
|
|
67
|
-
cnhkmcp
|
|
68
|
-
cnhkmcp-1.4.
|
|
69
|
-
cnhkmcp-1.4.
|
|
70
|
-
cnhkmcp-1.4.
|
|
71
|
-
cnhkmcp-1.4.
|
|
72
|
-
cnhkmcp-1.4.
|
|
68
|
+
cnhkmcp/untracked/mcp文件论坛版2_如果原版启动不了浏览器就试这个/配置前运行我_安装必要依赖包.py,sha256=2TDQKMo1sMwELUROgWTUolVYX1-zusUv54lrW3HCuUg,5464
|
|
69
|
+
cnhkmcp-1.4.6.dist-info/licenses/LICENSE,sha256=QLxO2eNMnJQEdI_R1UV2AOD-IvuA8zVrkHWA4D9gtoc,1081
|
|
70
|
+
cnhkmcp-1.4.6.dist-info/METADATA,sha256=FaQ-6Qw3W-KcPaC5MxQmbcevWIG8aW6XtRe2-GxURCU,5171
|
|
71
|
+
cnhkmcp-1.4.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
72
|
+
cnhkmcp-1.4.6.dist-info/entry_points.txt,sha256=lTQieVyIvjhSMK4fT-XwnccY-JBC1H4vVQ3V9dDM-Pc,70
|
|
73
|
+
cnhkmcp-1.4.6.dist-info/top_level.txt,sha256=x--ibUcSgOS9Z_RWK2Qc-vfs7DaXQN-WMaaxEETJ1Bw,8
|
|
74
|
+
cnhkmcp-1.4.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|