pinokiod 1.0.52 → 1.0.54
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.
- package/kernel/api/fs/index.js +78 -19
- package/kernel/python/index.js +1 -1
- package/kernel/python/mod.py +40 -0
- package/package.json +2 -2
- package/server/index.js +6 -1
- package/server/public/style.css +15 -6
- package/kernel/python/pip.py +0 -79
package/kernel/api/fs/index.js
CHANGED
|
@@ -113,40 +113,99 @@ class FS {
|
|
|
113
113
|
// pip sharing
|
|
114
114
|
// 1. get all pip items
|
|
115
115
|
let p
|
|
116
|
+
let drive_path
|
|
116
117
|
if (kernel.platform === "win32") {
|
|
117
118
|
p = path.resolve(req.cwd, req.params.venv, "Lib", "site-packages")
|
|
119
|
+
drive_path = "pip/Lib/site-packages"
|
|
118
120
|
} else {
|
|
119
121
|
p = path.resolve(req.cwd, req.params.venv, "lib", "python3.10", "site-packages")
|
|
122
|
+
drive_path = "pip/lib/python3.10/site-packages"
|
|
120
123
|
}
|
|
121
124
|
const res = await kernel.python.call(
|
|
122
|
-
"
|
|
123
|
-
path
|
|
124
|
-
"
|
|
125
|
+
"mod",
|
|
126
|
+
kernel.bin.path("py"),
|
|
127
|
+
"get",
|
|
125
128
|
[p],
|
|
126
129
|
ondata
|
|
127
130
|
)
|
|
128
|
-
|
|
131
|
+
console.log("RES", res)
|
|
129
132
|
// symlink:
|
|
130
133
|
// from => :package_path
|
|
131
134
|
// to => /drives/packages/pip/:package_name/:package_version
|
|
135
|
+
const drivePath = kernel.path("drive")
|
|
136
|
+
const drive = new Pdrive(drivePath)
|
|
132
137
|
for(let name in res) {
|
|
133
|
-
|
|
134
|
-
|
|
138
|
+
/*
|
|
139
|
+
torch: {
|
|
140
|
+
version: "2.1",
|
|
141
|
+
copy: [
|
|
142
|
+
'../../../bin/torchrun',
|
|
143
|
+
'../../../bin/convert-onnx-to-caffe2',
|
|
144
|
+
'../../../bin/convert-caffe2-to-onnx'
|
|
145
|
+
],
|
|
146
|
+
move: [
|
|
147
|
+
"torchgen",
|
|
148
|
+
"functorch",
|
|
149
|
+
"torch"
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
=>
|
|
155
|
+
|
|
156
|
+
{
|
|
157
|
+
copy: {
|
|
158
|
+
'../../../bin/torchrun': path.resolve(p, '../../../bin/torchrun')
|
|
159
|
+
'../../../bin/convert-onnx-to-caffe2': path.resolve(p, '../../../bin/convert-onnx-to-caffe2'),
|
|
160
|
+
'../../../bin/convert-caffe2-to-onnx': path.resolve(p, '../../../bin/convert-caffe2-to-onnx')
|
|
161
|
+
},
|
|
162
|
+
move: {
|
|
163
|
+
"torchgen": "torchgen",
|
|
164
|
+
"functorch": "functorch",
|
|
165
|
+
"torch": "torch"
|
|
166
|
+
},
|
|
167
|
+
parent: "pip/torch/2.1/lib/python3.10/site-packages"
|
|
168
|
+
}
|
|
169
|
+
*/
|
|
170
|
+
const copy = res[name].copy
|
|
171
|
+
const move = res[name].move
|
|
135
172
|
const version = res[name].version
|
|
136
|
-
|
|
173
|
+
|
|
174
|
+
console.log({ name, copy, move, version })
|
|
175
|
+
|
|
176
|
+
if (version) {
|
|
177
|
+
let site_packages_root;
|
|
178
|
+
if (kernel.platform === "win32") {
|
|
179
|
+
site_packages_root = `pip/${name}/${version}/Lib/site-packages`
|
|
180
|
+
} else {
|
|
181
|
+
site_packages_root = `pip/${name}/${version}/lib/python3.10/site-packages`
|
|
182
|
+
}
|
|
183
|
+
const d = {
|
|
184
|
+
copy: {},
|
|
185
|
+
move: {},
|
|
186
|
+
parent: site_packages_root
|
|
187
|
+
}
|
|
188
|
+
for(let relpath of copy) {
|
|
189
|
+
d.copy[relpath] = kernel.path("drive", p, relpath)
|
|
190
|
+
}
|
|
191
|
+
for(let relpath of move) {
|
|
192
|
+
d.move[relpath] = kernel.path("drive", p, relpath)
|
|
193
|
+
}
|
|
194
|
+
console.log("D", name, d)
|
|
195
|
+
ondata({
|
|
196
|
+
raw: "\r\nLINKING DRIVES:\r\n" + JSON.stringify(d, null, 2).replace(/\n/g, "\r\n")
|
|
197
|
+
})
|
|
198
|
+
await drive.create(d)
|
|
199
|
+
ondata({
|
|
200
|
+
raw: "Done.\r\n"
|
|
201
|
+
})
|
|
202
|
+
} else {
|
|
203
|
+
ondata({
|
|
204
|
+
raw: "\r\nNo version specified: " + name + " => Ignore"
|
|
205
|
+
})
|
|
206
|
+
}
|
|
207
|
+
|
|
137
208
|
}
|
|
138
|
-
ondata({
|
|
139
|
-
raw: "\r\nLINKING DRIVES:\r\n" + JSON.stringify(d, null, 2).replace(/\n/g, "\r\n")
|
|
140
|
-
})
|
|
141
|
-
const drivePath = kernel.path("drive")
|
|
142
|
-
const drive = new Pdrive(drivePath)
|
|
143
|
-
await drive.create({
|
|
144
|
-
drive: d,
|
|
145
|
-
parent: "packages/pip"
|
|
146
|
-
})
|
|
147
|
-
ondata({
|
|
148
|
-
raw: "Done.\r\n"
|
|
149
|
-
})
|
|
150
209
|
} else if (req.params.drive) {
|
|
151
210
|
const drivePath = kernel.path("drive")
|
|
152
211
|
const drive = new Pdrive(drivePath)
|
package/kernel/python/index.js
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import importlib
|
|
3
|
+
import importlib_metadata
|
|
4
|
+
import os
|
|
5
|
+
# Get all the pip packages for the base path
|
|
6
|
+
def get(sitepackages_base):
|
|
7
|
+
sys.path=[sitepackages_base]
|
|
8
|
+
importlib.invalidate_caches()
|
|
9
|
+
dists = importlib_metadata.packages_distributions()
|
|
10
|
+
dict = {}
|
|
11
|
+
for package_name in dists:
|
|
12
|
+
for dist_name in dists[package_name]:
|
|
13
|
+
dict[dist_name] = {}
|
|
14
|
+
# get package path
|
|
15
|
+
try:
|
|
16
|
+
meta = importlib_metadata.metadata(dist_name)
|
|
17
|
+
files = importlib_metadata.files(dist_name)
|
|
18
|
+
move = set()
|
|
19
|
+
copy = set()
|
|
20
|
+
for file in files:
|
|
21
|
+
filepath = os.path.join(sitepackages_base, file)
|
|
22
|
+
dirpath = os.path.abspath(os.path.dirname(filepath))
|
|
23
|
+
try:
|
|
24
|
+
relpath = Path(dirpath).relative_to(sitepackages_base)
|
|
25
|
+
# site package handling
|
|
26
|
+
chunks = str(relpath).split(os.sep)
|
|
27
|
+
if len(chunks) > 1:
|
|
28
|
+
folder = chunks[0]
|
|
29
|
+
move.add(os.path.join(sitepackages_base, folder))
|
|
30
|
+
except:
|
|
31
|
+
# non site package handling
|
|
32
|
+
# add the full file paths => so they can be copied
|
|
33
|
+
copy.add(str(filepath))
|
|
34
|
+
dict[dist_name]["copy"] = list(copy)
|
|
35
|
+
dict[dist_name]["move"] = list(move)
|
|
36
|
+
except Exception as error:
|
|
37
|
+
print(f"#ERR {error}")
|
|
38
|
+
return dict
|
|
39
|
+
if __name__ == "__main__":
|
|
40
|
+
get("/Users/x/pinokio/api/comfyui.git/app/env/lib/python3.10/site-packages")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pinokiod",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.54",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"node-calls-python": "^1.8.2",
|
|
44
44
|
"node-downloader-helper": "^2.1.9",
|
|
45
45
|
"node-pty-prebuilt-multiarch-cp": "^0.10.1-pre.48",
|
|
46
|
-
"pdrive": "^0.0.
|
|
46
|
+
"pdrive": "^0.0.23",
|
|
47
47
|
"portfinder": "^1.0.32",
|
|
48
48
|
"random-useragent": "^0.5.0",
|
|
49
49
|
"rimraf": "^5.0.0",
|
package/server/index.js
CHANGED
|
@@ -1174,7 +1174,12 @@ class Server {
|
|
|
1174
1174
|
}
|
|
1175
1175
|
}
|
|
1176
1176
|
}
|
|
1177
|
-
|
|
1177
|
+
console.log("menu item", config.menu[i])
|
|
1178
|
+
if (config.menu[i].popout) {
|
|
1179
|
+
config.menu[i].target = "_blank"
|
|
1180
|
+
} else {
|
|
1181
|
+
config.menu[i].target = "@" + (config.menu[i].id || config.menu[i].src)
|
|
1182
|
+
}
|
|
1178
1183
|
}
|
|
1179
1184
|
|
|
1180
1185
|
|
package/server/public/style.css
CHANGED
|
@@ -1037,8 +1037,8 @@ body.dark .btn {
|
|
|
1037
1037
|
background: rgba(0,0,0,0.8);
|
|
1038
1038
|
}
|
|
1039
1039
|
body.dark .swal2-popup {
|
|
1040
|
-
|
|
1041
|
-
|
|
1040
|
+
background: var(--dark-btn-bg);
|
|
1041
|
+
color: var(--dark-btn-color);
|
|
1042
1042
|
}
|
|
1043
1043
|
.swal2-popup {
|
|
1044
1044
|
border-radius: 0 !important;
|
|
@@ -1059,7 +1059,7 @@ body.dark .swal2-popup {
|
|
|
1059
1059
|
}
|
|
1060
1060
|
.swal2-html-container {
|
|
1061
1061
|
display: block !important;
|
|
1062
|
-
margin:
|
|
1062
|
+
margin: 0px 20px !important;
|
|
1063
1063
|
}
|
|
1064
1064
|
.swal2-html-container .desc:empty {
|
|
1065
1065
|
display: none;
|
|
@@ -1119,7 +1119,7 @@ body.dark .swal2-popup {
|
|
|
1119
1119
|
width: 100% !important;
|
|
1120
1120
|
justify-content: flex-end !important;
|
|
1121
1121
|
margin: 0 !important;
|
|
1122
|
-
padding:
|
|
1122
|
+
padding: 20px !important;
|
|
1123
1123
|
/*
|
|
1124
1124
|
background: rgba(0,0,200,0.04);
|
|
1125
1125
|
*/
|
|
@@ -1147,9 +1147,11 @@ body.dark .swal2-popup {
|
|
|
1147
1147
|
box-sizing: border-box;
|
|
1148
1148
|
}
|
|
1149
1149
|
body.dark .swal2-modal input {
|
|
1150
|
+
/*
|
|
1150
1151
|
background: var(--dark-btn-bg);
|
|
1152
|
+
*/
|
|
1151
1153
|
color: var(--dark-btn-color);
|
|
1152
|
-
border:
|
|
1154
|
+
border: 2px solid rgba(255,255,255,0.1);
|
|
1153
1155
|
}
|
|
1154
1156
|
.swal2-modal input {
|
|
1155
1157
|
/*
|
|
@@ -1166,11 +1168,18 @@ body.dark .swal2-modal input {
|
|
|
1166
1168
|
border-radius: 2px !important;
|
|
1167
1169
|
}
|
|
1168
1170
|
body.dark .swal2-styled.swal2-confirm{
|
|
1171
|
+
background: rgba(255,255,255,0.9) !important;
|
|
1172
|
+
color: black;
|
|
1173
|
+
/*
|
|
1169
1174
|
background: var(--dark-btn-bg);
|
|
1170
1175
|
color: var(--dark-btn-color);
|
|
1176
|
+
*/
|
|
1171
1177
|
}
|
|
1172
1178
|
.swal2-styled.swal2-confirm{
|
|
1173
|
-
background:
|
|
1179
|
+
background: rgba(0,0,0,0.8) !important;
|
|
1180
|
+
margin: 0;
|
|
1181
|
+
font-weight: bold;
|
|
1182
|
+
border: none;
|
|
1174
1183
|
}
|
|
1175
1184
|
.swal2-input {
|
|
1176
1185
|
margin: 0 !important;
|
package/kernel/python/pip.py
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import pkg_resources
|
|
2
|
-
import platform
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
import site
|
|
5
|
-
import sysconfig
|
|
6
|
-
import sys
|
|
7
|
-
import importlib
|
|
8
|
-
import importlib_metadata
|
|
9
|
-
import os
|
|
10
|
-
|
|
11
|
-
# Get all the pip packages for the base path
|
|
12
|
-
def list(sitepackages_base):
|
|
13
|
-
# print(f"LIST {sitepackages_base}")
|
|
14
|
-
sys.path=[sitepackages_base]
|
|
15
|
-
importlib.invalidate_caches()
|
|
16
|
-
|
|
17
|
-
# sys.path.insert(0, sitepackages_base)
|
|
18
|
-
print(f"sys.path={sys.path}")
|
|
19
|
-
print(f"sys.meta_path={sys.meta_path}")
|
|
20
|
-
print(f"sys.path_hooks={sys.path_hooks}")
|
|
21
|
-
#dists = importlib_metadata.packages_distributions()
|
|
22
|
-
dists = importlib_metadata.packages_distributions()
|
|
23
|
-
print(f"dists={dists}")
|
|
24
|
-
# print(f"DISTS {dists}")
|
|
25
|
-
|
|
26
|
-
# print(f"SYSPATH {sys.path}")
|
|
27
|
-
# for key in sys.modules:
|
|
28
|
-
# print(f"## {key}: {sys.modules[key]}")
|
|
29
|
-
# print(f"sys.modules={sys.modules}")
|
|
30
|
-
#print(f"BEFORE PATH: {sys.path}")
|
|
31
|
-
#print(f"AFTER PATH: {sys.path}")
|
|
32
|
-
# pkg_resources.working_set.add_entry(sitepackages_base)
|
|
33
|
-
sitepackages_path = sysconfig.get_paths()["purelib"]
|
|
34
|
-
dict = {}
|
|
35
|
-
# packages = importlib.resources.files(package)
|
|
36
|
-
for package_name in dists:
|
|
37
|
-
print(f"package_name={package_name}")
|
|
38
|
-
for dist_name in dists[package_name]:
|
|
39
|
-
# get package path
|
|
40
|
-
try:
|
|
41
|
-
meta = importlib_metadata.metadata(dist_name)
|
|
42
|
-
files = importlib_metadata.files(dist_name)
|
|
43
|
-
|
|
44
|
-
for file in files:
|
|
45
|
-
|
|
46
|
-
#if str(file).startswith("_"):
|
|
47
|
-
if str(file).startswith("__pycache__"):
|
|
48
|
-
continue
|
|
49
|
-
if str(file).startswith("."):
|
|
50
|
-
continue
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
# if the resolved path
|
|
54
|
-
abspath = os.path.join(sitepackages_base, file)
|
|
55
|
-
is_child = Path(abspath).is_relative_to(sitepackages_base) and (sitepackages_base in abspath)
|
|
56
|
-
if is_child:
|
|
57
|
-
relative = str(file)
|
|
58
|
-
chunks = relative.split(os.sep)
|
|
59
|
-
if len(chunks) > 1:
|
|
60
|
-
folder = chunks[0]
|
|
61
|
-
package_path = str(os.path.join(sitepackages_base, folder))
|
|
62
|
-
if not hasattr(dict, folder):
|
|
63
|
-
dict[folder] = {}
|
|
64
|
-
|
|
65
|
-
try:
|
|
66
|
-
dict[folder]["version"] = meta["Version"]
|
|
67
|
-
except:
|
|
68
|
-
print('no version')
|
|
69
|
-
dict[folder]["name"] = folder
|
|
70
|
-
dict[folder]["path"] = package_path
|
|
71
|
-
except Exception as error:
|
|
72
|
-
print(f"#ERR {error}")
|
|
73
|
-
# nothing
|
|
74
|
-
|
|
75
|
-
# get dist path (only if there's a version)
|
|
76
|
-
|
|
77
|
-
print(f"DICT={dict}")
|
|
78
|
-
|
|
79
|
-
return dict
|